Coverage.py
Coverage.py measures which parts of Python programs run and which executable code remains untouched, helping developers assess what their tests exercise.
What Coverage.py is
Coverage.py measures which parts of Python programs run and which executable code remains untouched, helping developers assess what their tests exercise. It measures statement coverage by default and can also report branch coverage. Available report formats include text, HTML, XML, LCOV, and JSON. Dynamic contexts can associate executed lines with the test function that ran them. Coverage.py can run test suites through their usual command; pytest-cov is available, though the documentation says it is unnecessary for most users. Third-party plugins can extend measurement to non-Python files, such as mapping executed Python to Django templates. Data is stored in a SQLite database, and advanced use can rely on the Coverage.py API. The documentation lists Python 3.10 through 3.15 rc2 and PyPy3 3.10 and 3.11. It offers ctrace, pytrace, and sysmon tracing cores; sysmon is faster for simple line and branch coverage but does not support dynamic contexts or plugins. Coverage.py is Apache 2.0 licensed and runs on Linux, macOS, and Windows, with self-hosting available.
Good
- Measures statement and branch coverage.
- Produces five report formats, including HTML and JSON.
- Dynamic contexts can link lines to test functions.
- Supports Linux, macOS, and Windows.
Watch out
- Sysmon does not support dynamic contexts or plugins.
- Documentation lists Python through 3.15 rc2.
- Professional support is through a Tidelift Subscription.
Who it suits
Coverage.py is for developers measuring how much of their Python code their tests exercise. Its report formats and dynamic contexts can help teams inspect coverage in different ways.
Verdict
Coverage.py provides Python test-coverage measurement with several report formats and tracing options. Choose a tracing core based on whether you need plugins or dynamic contexts.
Plans and prices
From Coverage.py's own pricing page, checked 3 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Coverage.py | Free | Open-source Python coverage tool · Enterprise subscription available through Tidelift |
| Free | Free | Python code coverage · command-line and API use · local reports · Free |
The facts
Each one read from Coverage.py's own pages, with the date it was checked.
What it does
- Branch coverage
- The tool can measure whether alternative branch paths were executed.checked 15 Oct 2026
- C extension
- A C extension is recommended for speed and is required for concurrency and plugin features; Linux builds may need development headers and GCC.checked 15 Oct 2026
- Configuration
- Settings can live in .coveragerc, TOML, setup.cfg, tox.ini, or pyproject.toml files.checked 15 Oct 2026
- Contexts
- Dynamic contexts can record which test function ran which lines of code.checked 3 Oct 2026
- Coverage data API
- `CoverageData` provides a supported interface for reading collected coverage data.checked 15 Oct 2026
- Coverage types
- It measures statement coverage by default and can also measure branch coverage.checked 3 Oct 2026
- Database format
- Collected results are stored in a SQLite database, whose schema is documented as advanced and subject to change.checked 15 Oct 2026
- Documentation and support
- Help is offered through extensive Read the Docs material, Python forums, Python Discord, GitHub issues, and optional Tidelift support.checked 15 Oct 2026
- Extensibility
- Third-party plugins can extend measurement to non-Python files, such as mapping executed Python back to Django HTML templates.checked 3 Oct 2026
- Installation
- The documented installation command is `python3 -m pip install coverage`.checked 15 Oct 2026
- Integrations
- Official examples cover pytest, unittest, and nose, and pytest commonly uses the pytest-cov plugin.checked 15 Oct 2026
- Intended users
- The documentation presents Coverage.py as a tool for people measuring Python test effectiveness by seeing which code tests exercise and which they miss.checked 3 Oct 2026
- Licence
- The package is distributed under the Apache 2.0 licence.checked 15 Oct 2026
- License
- Coverage.py is licensed under the Apache 2.0 License.checked 3 Oct 2026
- Limit: default test distinction
- ClickUp notes that Coverage.py does not automatically distinguish test code from the application code being tested.checked 15 Oct 2026
- Limit: dynamic execution
- Hysen Labs cautions that dynamically generated code using exec or eval may not be captured accurately.checked 15 Oct 2026
- Limit: language scope
- Independent reviews identify Python as the supported product language, limiting use for multi-language coverage programs.checked 15 Oct 2026
- Limit: measured performance
- A 2023 arXiv study measured median overhead of 180% on CPython and 1,300% on PyPy for coverage.py.checked 15 Oct 2026
- Limit: test-quality signal
- Pythonlib notes that execution coverage shows whether code ran but cannot determine whether tests assert correct outcomes.checked 15 Oct 2026
- Limit: tracing overhead
- Hysen Labs warns that tracing every executed line can noticeably slow large test suites.checked 15 Oct 2026
- Maintainer and adoption
- Batchelder's résumé describes him as solo maintainer since 2004 and reports use by about 34,000 PyPI packages, 65 million monthly downloads, and 365,000 GitHub repositories.checked 15 Oct 2026
- Maintainer history
- Ned Batchelder has extended and maintained the project since 2004.checked 15 Oct 2026
- Measurement cores
- Coverage.py offers ctrace and pytrace tracing cores plus a sysmon core; sysmon is faster for simple line and branch coverage but does not yet support dynamic contexts or plugins.checked 3 Oct 2026
- Notable organization change
- A November 2025 post announced moving the repository to the coveragepy GitHub organization and described the project as essentially a one-person effort.checked 15 Oct 2026
Alternatives to Coverage.py
- 1

Codecov
Free planOpen sourceWebAPIExtensionLinux8.0From $5 a month - 2
Avidemux
Free planOpen sourceWebLinuxmacOSWindows7.3Free plan - 3

Coveralls
Free planWebAPILinuxSelf-hosted6.8From $10 a month - 4
ReportGenerator
Free planLinuxmacOSWindows6.8$79 one-time - 5
gcov
Free planLinuxmacOSWindows6.5Free plan - 6
OpenClover
Free planWebLinuxmacOSWindows6.4Free plan
