Python · Comparison
Python coverage: coverage.py, SlipCover, and Supercov
Compare Python coverage tools: coverage.py with pytest-cov, SlipCover, and Supercov. See per-test contexts, MC/DC, and assertion coverage side by side.
Choose by what you need to measure
coverage.py is a useful starting point for Python line and branch coverage. pytest-cov integrates that engine with pytest; it is not a separate coverage engine. SlipCover is an alternative collector for line and branch coverage. Supercov adds MC/DC and source-to-assertion review to a runner-aware workflow.
| Feature | coverage.py7.16.0 | SlipCover1.1.0 | Supercov0.0.47 |
|---|---|---|---|
| Line coverage | Supported | Supported | Supported |
| Branch coverage | Supported | Supported | Supported |
| MC/DC | Not built in | Not built in | Supported |
| Per-test coverage | Supported | Not built in | Supported |
| Assertion coverage | Not built in | Not built in | Supported |
✓ Supported · × Not built in. Standard coverage workflows in the versions shown; custom plugins are outside this table.
Supercov requires CPython 3.12+ for full coverage. pytest-cov uses coverage.py; enable test contexts for per-test coverage.
Per-test coverage means individual tests, not just test files. Supercov needs a supported runner. Assertion coverage links source to checked properties through agent review; it is not a mutation score or a correctness guarantee.
coverage.py and pytest-cov
For an existing pytest project with both packages installed:
pytest --cov=src --cov-branch --cov-context=test
Replace src with your application’s package or directory. The last option records which tests exercised the code. This matters if you want to find the test responsible for a covered line, rather than see only a combined percentage. See pytest-cov’s contexts guide.
You can also run a unittest suite directly through coverage.py:
coverage run --branch -m unittest discover
coverage report -m
coverage.py supports measurement contexts. Supercov is not unique simply because it associates code with tests.
Where SlipCover fits
SlipCover offers another way to collect line and branch coverage, including a pytest launch path:
python -m slipcover --branch -m pytest
Its documentation describes supported Python versions and output options. If you evaluate it, use your real suite and the same source scope. A different collector’s percentage is not itself a test-quality score.
What branch coverage does not tell you
def can_access(signed_in, expired):
if signed_in and not expired:
return True
return False
assert can_access(True, False)
assert not can_access(False, False)
This checks both return paths, but not an expired session. The missing case is assert not can_access(True, True).
On our equivalent unittest fixture, coverage.py 7.16.0 and SlipCover 1.1.0 both reported 100% line and branch coverage. Supercov 0.0.46 reported one of two independent conditions covered. MC/DC makes that missing independence case explicit.
When to use Supercov
With Supercov installed in your Python environment:
supercov -- python -m pytest
supercov runs latest gaps
Use it when your question goes beyond “did this line run?” to “did each condition matter?” or “which result did a test actually check?” Full Python measurement requires CPython 3.12 or newer. See Python setup.
Assertion coverage uses an agent’s review of recorded execution and passing assertions. It is not a mutation score or a correctness proof. And Supercov is not the only Python MC/DC option: dedicated analyzers such as pymcdc address that narrower question too.
Example evidence: fixture source and recorded results (JSON). Measured September 13, 2026. These small examples are not a performance benchmark or a general conformance test.