Legacy Review Regression Test-Quality Rules¶
These rules codify the first-wave test-quality findings from the PR-review audit. The detector is intentionally narrow: it targets high-confidence weak mock-call assertions that frequently pass even when behavior is wrong.
Rule Class Coverage¶
This detector pack currently owns one pattern:
- Weak lower-bound assertions on
mock.call_countthat do not prove an exact interaction contract or concrete side effect.
Invariant Protected¶
weak-mock-call-count-lower-bound¶
Tests that only assert lower bounds for call_count can pass while still allowing wrong payloads, wrong ordering, or extra calls. This is especially problematic in facade and orchestration tests where argument correctness is the main contract.
Flagged forms:
assert mock.call_count >= 1
assert mock.call_count > 0
assert 1 <= mock.call_count
assert 0 < mock.call_count
Approved Strong Patterns¶
These are not flagged by this detector:
The first pattern is an exact quantitative contract. The second pattern verifies payload semantics directly, which is the preferred assertion style for mocked interactions.
Scan Modes¶
The detector supports two modes:
full_reposcans all Python files undertests/.changed_test_filesscans only test files identified as changed.
Non-test source files are always excluded, even when they contain lookalike assertions.