PY-TEST0016 · concentrated_test_reach_cluster_count
Count production graph reach clusters with repeated test intent.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Treat the transitively reachable production declarations of one collected test as its static
graph coverage set. Group tests with the same set and fixture closure. Report a group with at
least minimum_tests tests when more than one literal-neutral body exists but the distinct
body count is no more than half the test count. The repeated bodies are zero-marginal static
coverage inside that cluster and are candidates for consolidation or parametrization.
Evidence
Section titled “Evidence”Each finding lists the tests and measures test count, reachable production declarations, and distinct literal-neutral bodies. This exposes both over-coverage concentration and behavioral diversity instead of claiming that a popular production function is redundant merely because many tests reach it. The value is the number of concentrated reach clusters.
Exceptions
Section titled “Exceptions”A cluster with no production reach abstains. Exact duplicate bodies belong to PY-TEST0015.
A cluster where most tests state distinct bodies is diverse and remains valid. Runtime-only
dispatch, native calls, and data-dependent branches can add coverage the static graph cannot
prove, so the finding requests review and has no automatic repair.
Examples
Section titled “Examples”Bad
Six `test_parse_*` cases reach the same four production declarations through two repeated bodyshapes, so the value is `1`.
GoodSix test_protocol_* cases have six distinct body shapes, so the value remains 0.
References
Section titled “References”- Cites “Software Testing and Analysis”, graph coverage criteria
- Cites “xUnit Test Patterns”, test code duplication