CheckOps home

Tools directory

C

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.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

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

  1. Line and branch coverage: Find untested lines and untaken branches.
  2. Rich reports: Terminal, HTML, XML, JSON and LCOV.
  3. Thresholds: fail_under fails builds below a target.
  4. Combine data: Merge results from parallel or multi-process runs.

Pros

  1. Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 11 November 2026.
  3. Community: About 3,400 GitHub stars.

Cons

  1. Coverage is not quality: High coverage can still miss weak assertions; pair with mutation testing.
  2. Some overhead: Tracing slows tests, though newer Python versions reduce it.
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.

  1. Every Python project that wants to see untested code.
  2. 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.