Skip to content

feat(flaky-detection): Add mark to exclude tests from flaky-detection reruns#441

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/remyduthu/flaky-detection-opt-out-mark/add-mark-exclude-tests-flaky-detection-reruns--afe9ba67
Jul 7, 2026
Merged

feat(flaky-detection): Add mark to exclude tests from flaky-detection reruns#441
mergify[bot] merged 1 commit into
mainfrom
devs/remyduthu/flaky-detection-opt-out-mark/add-mark-exclude-tests-flaky-detection-reruns--afe9ba67

Conversation

@remyduthu

@remyduthu remyduthu commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings July 7, 2026 09:42
@mergify mergify Bot had a problem deploying to Mergify Merge Protections July 7, 2026 09:42 Failure
@mergify

mergify Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 6 merge protections satisfied — ready to merge.

Show 6 satisfied protections

🟢 Approval

  • #approved-reviews-by >= 2

🟢 Continuous Integration

  • all of:
    • check-success = codespell
    • check-success = test (3.10)
    • check-success = test (3.11)
    • check-success = test (3.12)
    • check-success = test (3.13)
    • check-success = test (3.14)
    • check-success = test (3.8)
    • check-success = test (3.9)

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify mergify Bot requested a review from a team July 7, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 both new and unhealthy modes.
  • 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.

Comment thread tests/test_ci_insights.py
Comment thread tests/test_ci_insights.py Outdated
Comment thread tests/test_ci_insights.py
Comment thread pytest_mergify/flaky_detection.py
Comment thread pytest_mergify/__init__.py Outdated
Comment thread pytest_mergify/flaky_detection.py Outdated
@remyduthu remyduthu force-pushed the devs/remyduthu/flaky-detection-opt-out-mark/add-mark-exclude-tests-flaky-detection-reruns--afe9ba67 branch from 199e931 to 39ead0b Compare July 7, 2026 10:27
@remyduthu

remyduthu commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 199e931 2026-07-07 10:27 UTC
2 content 199e931 → 39ead0b (raw) 2026-07-07 10:27 UTC
3 content 39ead0b → 1260e86 (raw) 2026-07-07 10:37 UTC

@mergify mergify Bot had a problem deploying to Mergify Merge Protections July 7, 2026 10:27 Failure
@remyduthu remyduthu marked this pull request as ready for review July 7, 2026 10:34
Comment thread pytest_mergify/__init__.py Outdated
Comment thread pytest_mergify/flaky_detection.py Outdated
Comment thread pytest_mergify/flaky_detection.py Outdated
… 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
@remyduthu remyduthu force-pushed the devs/remyduthu/flaky-detection-opt-out-mark/add-mark-exclude-tests-flaky-detection-reruns--afe9ba67 branch from 39ead0b to 1260e86 Compare July 7, 2026 10:37
@mergify mergify Bot deployed to Mergify Merge Protections July 7, 2026 10:37 Active
@remyduthu remyduthu requested a review from a team July 7, 2026 12:05

@JulianMaurin JulianMaurin 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 👍

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!

@mergify

mergify Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-07 12:17 UTC · Rule: default · triggered by merge protections
  • Checks skipped · PR is already up-to-date
  • Merged2026-07-07 12:17 UTC · at 1260e863c9dce52196a5949bf994ee584d187136 · squash

This pull request spent 35 seconds in the queue, including 6 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit f2e73fd into main Jul 7, 2026
20 checks passed
@mergify mergify Bot deleted the devs/remyduthu/flaky-detection-opt-out-mark/add-mark-exclude-tests-flaky-detection-reruns--afe9ba67 branch July 7, 2026 12:17
@mergify mergify Bot added queued and removed queued labels Jul 7, 2026
remyduthu added a commit that referenced this pull request Jul 7, 2026
…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
mergify Bot pushed a commit that referenced this pull request Jul 7, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants