CheckOps
Coverage.py
Coverage.py is the standard Apache-2.0 code coverage tool for Python, measuring line and branch coverage and producing terminal, HTML, XML, JSON and LCOV reports; pytest-cov builds on it.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Coverage.py, created and maintained by Ned Batchelder, is the code coverage tool for Python. It monitors your program while tests run, notes which lines (and optionally which branches) executed, and reports what was missed. Nearly every Python coverage workflow uses it, either directly or through the pytest-cov plugin.
You run your tests under it with coverage run -m pytest, then view results with coverage report -m (showing missing line numbers), coverage html for an annotated browsable report, or coverage xml, coverage json and coverage lcov for CI services. Branch coverage (--branch) reveals untaken if paths. Configuration lives in .coveragerc, setup.cfg, tox.ini or pyproject.toml, covering source selection, omit patterns, exclusion pragmas and fail_under thresholds. For parallel and multi-process runs, data files are combined with coverage combine. On Python 3.12 and later, Coverage.py can use the low-overhead sys.monitoring API to reduce slowdown. The latest release, 7.17.2, came out on 4 November 2026.
The source code is at coveragepy/coveragepy on GitHub under the Apache-2.0 licence, with about 3,400 stars; the most recent commit was on 11 November 2026.
Features
- Line and branch coverage: Find untested lines and untaken branches.
- Rich reports: Terminal, HTML, XML, JSON and LCOV.
- Thresholds:
fail_underfails builds below a target. - Combine data: Merge results from parallel or multi-process runs.
Pros
- Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 11 November 2026.
- Community: About 3,400 GitHub stars.
Cons
- Coverage is not quality: High coverage can still miss weak assertions; pair with mutation testing.
- Some overhead: Tracing slows tests, though newer Python versions reduce it.
Usage and Links (Example)
pip install coverage
coverage run --branch -m pytest
coverage report -m --fail-under=85
coverage html # open htmlcov/index.html
pyproject.toml:
[tool.coverage.run]
source = ["src"]
branch = true
[tool.coverage.report]
fail_under = 85
show_missing = true
Resources:
Pricing
Coverage.py is free and open source under the Apache-2.0 licence.
Recommended for?
- Every Python project that wants to see untested code.
- CI pipelines enforcing coverage thresholds or uploading to Codecov or Coveralls.
Conclusion
Coverage.py is the indispensable, well-maintained coverage tool for Python, simple to start with and flexible enough for complex CI setups.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Coverage.py side by side.
- Ppytestpytest is the usual Python test runner: plain asserts, fixtures, parametrization, and a large plugin set.Compare with Coverage.py
PPython unittestunittest is Python's built-in xUnit-style testing framework, with TestCase classes, fixtures, test discovery, subtests, async test cases and the unittest.mock library, available in every Python install.Compare with Coverage.py
CCodecovCodecov by Sentry is a code coverage reporting service that shows coverage for any language, CI and code host in pull request comments and dashboards, with flags, carryforward, test analytics for flaky tests and AI test generation.Compare with Coverage.py
CCoverallsCoveralls is a hosted code coverage history and statistics service that integrates with your CI to report repository, file and line-by-line coverage with pull request notices; free for open source with paid plans for private repos.Compare with Coverage.py
Mmutmutmutmut is a BSD-3-Clause mutation testing tool for Python that changes your code in small ways and reports which mutants your tests fail to kill, with a terminal UI for browsing results.Compare with Coverage.py
Ttoxtox is an MIT-licensed command-line test automation tool for Python that creates isolated environments to run tests across Python versions and dependency sets, locally and in CI.Compare with Coverage.py