QA-PY-106 — Browser state shared across tests
Generated from the rule registry. Get the same detail from the CLI with
mjolnir explain QA-PY-106.
| Field | Value |
|---|---|
| Severity | warning |
| Confidence | medium |
| Tier | extended |
| Measured FP rate | 0% (n=14) |
| Evidence level | E1 |
| QA impact | Flaky-test risk (FLAKY-RISK) |
| False-positive risk (author estimate) | medium |
| Autofix available | no |
| Languages | python |
| Frameworks | pytest |
| Detection strategy | LEXICAL |
| Introduced in | v0.4.0 |
Why this fails in production
A shared Page/Browser leaks cookies, localStorage, and navigation state between tests — failures become order-dependent and impossible to reproduce in isolation.
What gets flagged (real detector output)
Module-level `page = ` — browser state shared across tests.Example from this rule's own must-fire fixture: tests/fixtures/QA-PY-106/must-fire/test_home.py
The fix
Take the injected page fixture parameter in each test instead of creating module-level state.
Confirmed NOT to fire on the corresponding clean pattern
Verified against tests/fixtures/QA-PY-106/must-not-fire/test_home.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):
| Repo | Occurrences |
|---|---|
| positive-fixtures | 4 |