PY-TEST0019 · production_reach_hotspot_count
Count production declarations reached repeatedly by low-diversity tests.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Explode each collected test’s transitive production reach into individual declarations. Group
tests by declaration and report a group with at least minimum_tests tests when the number of
distinct literal-neutral bodies is no more than half the test count. This is a static
over-coverage hotspot where parametrization, a generated property, or consolidation deserves
review even when the tests reach different secondary declarations.
Evidence
Section titled “Evidence”Each finding names the shared production declaration and the tests that reach it. Measurements
report test count, one shared target, and distinct body count. PY-TEST0016 remains the
stronger signal for tests whose complete reachable declaration sets are identical. The value
is the number of low-diversity production reach hotspots.
Exceptions
Section titled “Exceptions”Unresolved tests abstain. A declaration with mostly distinct test bodies remains valid. A shared facade, constructor, protocol method, or error type can legitimately have broad reach, so this rule requests review and offers no automatic deletion or rewrite.
Examples
Section titled “Examples”Bad
Ten `test_parse_*` cases reach one parser through four repeated body shapes, so the value is`1`.
GoodTen test_protocol_* cases use eight distinct bodies, so the value remains 0.
References
Section titled “References”- Cites “Software Testing and Analysis”, graph coverage criteria
- Cites “Growing Object-Oriented Software, Guided by Tests”, maintaining test intent