Repository navigation
test(verify): pin marker+forceselect pairing invariant (#1632) - #1648
Conversation
PR #1550 fixed a silent regression where the default ``devtools verify`` pytest step combined ``-m`` marker filters with testmon affected selection — per pytest-testmon docs, any non-trivial marker selector deactivates testmon's affected selection unless ``--testmon-forceselect`` is also passed. The bug ran for a full week, every default verify expanding to ~9,500 tests instead of the affected subset (200-427 s instead of <10 s), with no failing test surfacing the regression. This adds two regression tests pinning the invariant: - ``test_default_testmon_step_pairs_marker_filter_with_forceselect``: when the default lane includes ``-m`` markers, ``--testmon-forceselect`` must also be in the command. The assertion message names #1550 and #1632 so any future regression points directly at this guard. - ``test_skip_slow_testmon_step_keeps_forceselect_with_compound_marker``: ``--skip-slow`` composes ``and not slow`` into the marker expression; the pairing invariant still holds. These complement the existing ``test_marker_filters_keep_testmon_selection_forced`` and ``test_skip_slow_composes_with_forced_testmon_selection``. The existing tests assert specific marker tokens are present; the new tests assert the conditional invariant directly (IF -m present THEN --testmon-forceselect present), so a future change that swaps the marker tokens still trips the guard.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTwo unit tests enforce a regression guard that ensures any ChangesTestmon Marker Filter Regression Guard
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
PR #1550 silently ran ~9,500 tests instead of the affected subset for a full week before being caught — a marker filter (`-m not scale_*`) deactivated pytest-testmon affected selection, with no failing test to surface the regression. This adds two unit tests pinning the marker+`--testmon-forceselect` pairing invariant so the footgun cannot re-land silently. Closes #1632.
Problem
Per pytest-testmon docs, any non-trivial `-m` marker selection deactivates testmon's affected-test selection unless `--testmon-forceselect` is also passed. PR #1550 added the flag; this PR makes sure it stays there.
The existing tests assert specific marker tokens are present (`not scale_medium`, `not scale_large`), so a future change that swaps the marker vocabulary could pass those tests while still removing `--testmon-forceselect`. The new tests assert the conditional invariant directly: IF `-m` is in the command THEN `--testmon-forceselect` is also in the command — independent of the marker tokens themselves.
Solution
Two focused unit tests under `tests/unit/devtools/test_verify.py`:
The assertion message in both tests names #1550 and #1632 so any future failure trace points directly at the regression history.
This matches the recommended Option 3 from #1632:
Verification
```
$ pytest tests/unit/devtools/test_verify.py
36 passed (2 new)
$ devtools verify --quick
"exit_code": 0
```
Both new tests pass against current code. To verify they actually catch the regression, I locally deleted the `pytest_cmd.append("--testmon-forceselect")` line in `devtools/verify.py:384` — both new tests fail with the named assertion message, the existing tests fail too.
Summary by CodeRabbit