Skip to content

Document and test flaky(reruns=0) opting a test out of reruns - #376

Merged
icemac merged 2 commits into
pytest-dev:masterfrom
LouisDeconinck:issue-187-disable-rerun-marker
Sep 24, 2026
Merged

icemac merged 2 commits into
pytest-dev:masterfrom
LouisDeconinck:issue-187-disable-rerun-marker

Conversation

@LouisDeconinck

@LouisDeconinck LouisDeconinck commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • @pytest.mark.flaky(reruns=0) already disables reruns for a single test because the marker takes priority over the global --reruns/ini setting — this PR pins that behavior with regression tests and documents it
  • Caveats covered: --force-reruns still overrides the marker, and --reruns-mode=append adds the marker count to the global count (so reruns=0 does not opt out in append mode)

Closes #187

Test plan

  • flaky(reruns=0) + --reruns 5 → test runs once, fails
  • flaky(reruns=0) + --reruns-mode append → still reruns (documented caveat)
  • flaky(reruns=0) + --force-reruns 1 → still reruns (documented caveat)

The marker already takes priority over the global --reruns setting, so
@pytest.mark.flaky(reruns=0) disables reruns for one test. Add regression
tests pinning this behavior (including the --force-reruns and
--reruns-mode=append caveats) and document it.

Closes pytest-dev#187.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@icemac
icemac enabled auto-merge (squash) September 24, 2026 06:44

@icemac icemac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thank you for this PR. 😃

@icemac
icemac merged commit 63f8eb0 into pytest-dev:master Sep 24, 2026
45 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.

Decorator to disable a test rerunning

2 participants