Skip to content

QA-PY-001 — Focused test committed ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-PY-001.

FieldValue
Severityerror
Confidencehigh
Tierextended
Measured FP rate0% (n=12)
Evidence levelE2
QA impactFalse-green risk (FALSE-GREEN)
False-positive risk (author estimate)low
Autofix availableno
Languagespython
Frameworkspytest
Detection strategyLEXICAL
Introduced inv0.3.0

Why this fails in production ​

A hardcoded pytest.main([..., "-k", ...]) call or ::-scoped node selection committed into source, or an @pytest.mark.only marker from a focus-test plugin, restricts which tests actually run the same way JavaScript's .only does — the rest of the suite is deselected, not merely deprioritized. If that code path runs in CI unmodified, the job reports green having executed a fraction of the suite. This is the same mechanism as QA-TEST-001, expressed through pytest's own selection APIs rather than a test-runner .only method.

What gets flagged (real detector output) ​

Focused-test selection committed: `pytest.main(["tests/", "-k"`.

Example from this rule's own must-fire fixture: tests/fixtures/QA-PY-001/must-fire/focused.py

The fix ​

Remove the -k/:: selection from committed code; pass it on the command line locally instead.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-PY-001/must-not-fire/clean.py — a legitimate, similar-looking pattern this rule correctly leaves alone.

Corpus-measured false-positive risk ​

Real occurrence counts from npm run corpus:audit against actively-maintained OSS repos — reproduce yourself, don't just trust this table (see the false-positive audit):

RepoOccurrences
positive-fixtures12

Released under the MIT License.