Skip to content

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.

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.

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.

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.

Bad

Ten `test_parse_*` cases reach one parser through four repeated body shapes, so the value is
`1`.
Good

Ten test_protocol_* cases use eight distinct bodies, so the value remains 0.

  • Cites “Software Testing and Analysis”, graph coverage criteria
  • Cites “Growing Object-Oriented Software, Guided by Tests”, maintaining test intent