Skip to content

Prevent negative reruns from skipping initial test execution - #360

Merged
icemac merged 1 commit into
pytest-dev:masterfrom
janmrow:fix-359-negative-reruns
Sep 3, 2026
Merged

Prevent negative reruns from skipping initial test execution#360
icemac merged 1 commit into
pytest-dev:masterfrom
janmrow:fix-359-negative-reruns

Conversation

@janmrow

@janmrow janmrow commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #359.

Negative rerun counts could skip the test entirely, because the rerun limit was checked before the first run.

This change ensures that the initial test execution is never suppressed by the rerun count.
Negative values no longer produce a false success without running the test.

Regression tests cover the supported rerun configuration sources, and also the distributed StatusDB path with xdist.
I also ran some local A/B checks for non-negative rerun counts, xdist worker crashes, exclusions, and other negative values.

@icemac

icemac commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for this PR. 😃

@icemac
icemac merged commit 968fb6c into pytest-dev:master Sep 3, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Negative rerun counts can skip tests with exit code 0

2 participants