Coverage.py
coverage.readthedocs.io
What it is
Coverage.py measures which parts of Python programs run and highlights executable code that remains untouched, helping developers assess what their tests exercise. It measures statement coverage by default and can also track branch coverage. Reports are available as text, HTML, XML, LCOV, and JSON. Dynamic contexts can associate lines of execution with the test function that ran them. Coverage.py can run test suites through their usual command; pytest-cov is available but the documentation says most users do not need it. Third-party plugins can extend measurement to non-Python files, such as connecting executed Python to Django templates. Data is stored in a SQLite database, and advanced use can rely on its API. The current documentation lists Python 3.10 through 3.15 rc2 and PyPy3 versions 3.10 and 3.11. The tool provides ctrace, pytrace, and sysmon measurement cores; sysmon is faster for simple line and branch coverage but lacks support for dynamic contexts and plugins. Coverage.py is licensed under Apache 2.0 and runs on Linux, macOS, and Windows, with self-hosting available. It is free.
Spec sheet
- What it does
- Coverage.py traces Python execution and identifies executable source lines that tests did not run.Read 15 Oct 2026 · coverage.readthedocs.io
- Purpose
- Coverage.py measures which parts of Python programs ran and identifies executable code that did not run, commonly to gauge test effectiveness.Read 3 Oct 2026 · coverage.readthedocs.io
- 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.Read 3 Oct 2026 · coverage.readthedocs.io
- Integrations
- Official examples cover pytest, unittest, and nose, and pytest commonly uses the pytest-cov plugin.Read 15 Oct 2026 · coverage.readthedocs.io
- Security
- The project directs vulnerability reports to Tidelift, which it says will coordinate the fix and disclosure.Read 3 Oct 2026 · github.com
- Support
- Users can seek help on the Python discussion forums or Python Discord, report bugs on GitHub, and obtain professional support through Tidelift Subscription.Read 3 Oct 2026 · coverage.readthedocs.io
- License
- Coverage.py is licensed under the Apache 2.0 License.Read 3 Oct 2026 · github.com
- Branch coverage
- The tool can measure whether alternative branch paths were executed.Read 15 Oct 2026 · coverage.readthedocs.io
- 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.Read 15 Oct 2026 · coverage.readthedocs.io
- Configuration
- Settings can live in .coveragerc, TOML, setup.cfg, tox.ini, or pyproject.toml files.Read 15 Oct 2026 · coverage.readthedocs.io
- Contexts
- Dynamic contexts can record which test function ran which lines of code.Read 3 Oct 2026 · coverage.readthedocs.io
- Coverage data API
- `CoverageData` provides a supported interface for reading collected coverage data.Read 15 Oct 2026 · coverage.readthedocs.io
- Coverage types
- It measures statement coverage by default and can also measure branch coverage.Read 3 Oct 2026 · coverage.readthedocs.io
- Database format
- Collected results are stored in a SQLite database, whose schema is documented as advanced and subject to change.Read 15 Oct 2026 · coverage.readthedocs.io
- Documentation and support
- Help is offered through extensive Read the Docs material, Python forums, Python Discord, GitHub issues, and optional Tidelift support.Read 15 Oct 2026 · coverage.readthedocs.io
- Extensibility
- Third-party plugins can extend measurement to non-Python files, such as mapping executed Python back to Django HTML templates.Read 3 Oct 2026 · coverage.readthedocs.io
- Installation
- The documented installation command is `python3 -m pip install coverage`.Read 15 Oct 2026 · coverage.readthedocs.io
- Licence
- The package is distributed under the Apache 2.0 licence.Read 15 Oct 2026 · pypi.org
- Limit: default test distinction
- ClickUp notes that Coverage.py does not automatically distinguish test code from the application code being tested.Read 15 Oct 2026 · clickup.com
- Limit: dynamic execution
- Hysen Labs cautions that dynamically generated code using exec or eval may not be captured accurately.Read 15 Oct 2026 · hysenlabs.com
- Limit: language scope
- Independent reviews identify Python as the supported product language, limiting use for multi-language coverage programs.Read 15 Oct 2026 · hysenlabs.com
- Limit: measured performance
- A 2023 arXiv study measured median overhead of 180% on CPython and 1,300% on PyPy for coverage.py.Read 15 Oct 2026 · arxiv.org
- Limit: test-quality signal
- Pythonlib notes that execution coverage shows whether code ran but cannot determine whether tests assert correct outcomes.Read 15 Oct 2026 · pythonlib.org
- Limit: tracing overhead
- Hysen Labs warns that tracing every executed line can noticeably slow large test suites.Read 15 Oct 2026 · hysenlabs.com
- 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.Read 15 Oct 2026 · nedbatchelder.com
- Maintainer history
- Ned Batchelder has extended and maintained the project since 2004.Read 15 Oct 2026 · nedbatchelder.com
- 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.Read 3 Oct 2026 · coverage.readthedocs.io
- 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.Read 15 Oct 2026 · nedbatchelder.com
- Notable release
- Version 7.16.2, released September 27, 2026, fixed Python 3.14 branch and try coverage issues and dynamic-context issues involving static and class methods.Read 15 Oct 2026 · coverage.readthedocs.io
- Package status
- PyPI classifies coverage as production/stable, operating-system independent, and requiring Python 3.10 or newer.Read 15 Oct 2026 · pypi.org
- Plugin system
- Python plugins can extend measurement to non-Python files and customize configuration.Read 15 Oct 2026 · coverage.readthedocs.io
- Praise: approachable workflow
- Pythonlib describes the workflow as running alongside tests and producing a color-coded view of tested and untested lines.Read 15 Oct 2026 · pythonlib.org
- Praise: report coverage
- ClickUp's independent roundup highlights line and branch coverage, HTML reports, CI integration, and test-runner support.Read 15 Oct 2026 · clickup.com
- Project origin
- Coverage.py began in 2001 as Gareth Rees's project.Read 15 Oct 2026 · nedbatchelder.com
- Public API
- The documented Python API centers on `coverage.Coverage`, with methods such as start, stop, save, and html_report.Read 15 Oct 2026 · coverage.readthedocs.io
- Rating on SourceForge
- 0.0 out of 5 from 0 reviewsRead 15 Oct 2026 · sourceforge.net
- Report formats
- Reports can be emitted as text, HTML, XML, LCOV, or JSON.Read 15 Oct 2026 · coverage.readthedocs.io
- Reports
- It can produce text, HTML, XML, LCOV, and JSON reports.Read 3 Oct 2026 · coverage.readthedocs.io
- Repository scale
- The coveragepy GitHub organization repository shows about 3.4 thousand stars and more than 500 forks.Read 15 Oct 2026 · github.com
- Security reporting
- PyPI directs vulnerability reports to Tidelift, which coordinates fixes and disclosure.Read 15 Oct 2026 · pypi.org
- Self-hosting
- Independent coverage reviews describe it as a local or self-hosted tool rather than a hosted coverage service.Read 15 Oct 2026 · hysenlabs.com
- SourceForge pricing
- SourceForge lists Coverage.py's starting price as Free and says a free version is available.Read 15 Oct 2026 · sourceforge.net
- Statement coverage
- Statement or line coverage is the default measurement mode.Read 15 Oct 2026 · coverage.readthedocs.io
- Storage and API
- Coverage data is stored in a SQLite database, and advanced usage can use the Coverage.py API.Read 3 Oct 2026 · coverage.readthedocs.io
- Supported interpreters
- The current documentation supports Python 3.11 through 3.15, including free-threading, and PyPy3 3.11.Read 15 Oct 2026 · coverage.readthedocs.io
- Test contexts
- Static and dynamic measurement contexts can associate executed lines with particular tests or situations.Read 15 Oct 2026 · coverage.readthedocs.io
Plans and prices
Strong points and limits
Strong points
- Free and Apache 2.0 licensed
- Measures statement and branch coverage
- Produces five report formats
- Dynamic contexts link lines to test functions
Limits
- sysmon does not support dynamic contexts
- sysmon does not support plugins
Who it suits
Coverage.py suits Python developers who want to see which code their tests execute and which executable code they miss. Its reports, contexts, and API also serve teams that need different ways to inspect coverage data.
Verdict
Coverage.py offers multiple coverage measures and report formats at no cost. Choose its tracing core with care if dynamic contexts or plugins are needed, since sysmon does not support them.
Where Specifiction places it
- Test Coverage Tools#2 of 278.9