PY-TEST0007 · coverage_without_branch_measurement
Detect configured coverage that measures statements without branches.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Return true when Coverage.py or pytest-cov is configured but branch measurement is not
enabled. Resolve .coveragerc, .coveragerc.toml, setup.cfg, tox.ini, and
pyproject.toml using Coverage.py’s documented precedence. A repository --cov-config
override is honored. branch = true in the effective run section or --cov-branch in pytest
addopts satisfies the rule. Coverage-free projects abstain with false.
Evidence
Section titled “Evidence”The finding identifies the selected coverage or pytest configuration file and records that statement coverage is configured without branch arcs. The result never guesses from a report percentage.
Exceptions
Section titled “Exceptions”A project that intentionally measures only statements can disable this rule explicitly. Environment variables and CI-only flags are not assumed unless they are represented in a repository configuration file.
Examples
Section titled “Examples”[tool.coverage.run]source = ["package"][tool.coverage.run]source = ["package"]branch = trueReferences
Section titled “References”- Cites “Coverage.py documentation”, configuration reference. Open reference
- Cites “Coverage.py documentation”, branch coverage. Open reference
- Cites “pytest-cov documentation”, configuration. Open reference