feat(flaky-detection): Add mark to exclude tests from flaky-detection reruns#441
Conversation
Merge Protections🟢 All 6 merge protections satisfied — ready to merge. Show 6 satisfied protections🟢 Approval
🟢 Continuous Integration
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-out mechanism for flaky-detection reruns by introducing a mergify pytest mark option (flaky_detection=False), allowing authors to exclude specific tests (e.g., expensive or volatile-nodeid tests) from the rerun loop while keeping the plugin enabled.
Changes:
- Exclude tests marked with
@pytest.mark.mergify(flaky_detection=False)from flaky-detection processing in bothnewandunhealthymodes. - Register the
mergify(flaky_detection=bool)marker with pytest to avoid unknown-marker warnings and document the option. - Add an end-to-end test asserting opted-out tests are not rerun and do not appear in the flaky-detection report.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/test_ci_insights.py | Adds an end-to-end test ensuring opted-out tests don’t enter flaky-detection reruns/reporting. |
| pytest_mergify/flaky_detection.py | Implements opt-out filtering during session preparation and adds a helper to detect the disabling mark. |
| pytest_mergify/init.py | Registers the new mergify marker and documents the flaky_detection option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
199e931 to
39ead0b
Compare
Revision history
|
… reruns Some tests do not benefit from rerun-based flaky detection: migration tests, expensive integration tests, or tests whose nodeid embeds a volatile value (e.g. a commit SHA in a parametrize id) that makes `new` mode flag them as new on every run and rerun them pointlessly. Provide `@pytest.mark.mergify(reruns=False)` so authors can opt a test out of the rerun loop in every mode, without disabling the plugin or altering the test's identity. Change-Id: Iafe9ba67112c1647c4977c1a9093e998042f7c71
39ead0b to
1260e86
Compare
JulianMaurin
left a comment
There was a problem hiding this comment.
LGTM 👍
One naming thought, totally non-blocking: reruns=False borrows the pytest-rerunfailures kwarg, but there it's an int count (@pytest.mark.flaky(reruns=5)), so a plural noun as a bool reads a bit odd. And since the mark opts the test out of flaky detection entirely (no cicd.test.* flaky attributes at all), not just the rerun loop, maybe mergify(flaky_detection=False) would describe the behavior more accurately — and leaves room for other per-test options later. reruns=0 could be an alternative if you'd rather stay in the rerunfailures vocabulary. Feel free to ignore!
Merge Queue Status
This pull request spent 35 seconds in the queue, including 6 seconds running CI. Required conditions to merge
|
…ction` The per-test opt-out shipped as `@pytest.mark.mergify(reruns=False)` in #441. Rename it to `flaky_detection=False`: the option governs Mergify's flaky-detection reruns specifically, so a `flaky_detection` name makes that scope explicit and avoids confusion with generic rerun plugins such as pytest-rerunfailures. Change-Id: Ib3e7f9601127fe5d3e8ae16de452dedfc288f231
…ction` (#442) The per-test opt-out shipped as `@pytest.mark.mergify(reruns=False)` in #441. Rename it to `flaky_detection=False`: the option governs Mergify's flaky-detection reruns specifically, so a `flaky_detection` name makes that scope explicit and avoids confusion with generic rerun plugins such as pytest-rerunfailures.
Some tests do not benefit from rerun-based flaky detection: migration tests,
expensive integration tests, or tests whose nodeid embeds a volatile value
(e.g. a commit SHA in a parametrize id) that makes
newmode flag them as newon every run and rerun them pointlessly.
Provide
@pytest.mark.mergify(reruns=False)so authors can opt a test out ofthe rerun loop in every mode, without disabling the plugin or altering the
test's identity.