pytest-cov
Pytest plugin for measuring coverage.
Decision gist · record as of 2026-08-14
Yes. pytest-cov is a mature, actively maintained plugin in the top 1000 PyPI packages with no known vulnerabilities. It has low install friction, permissive MIT licensing, and solves a standard testing need—coverage measurement—cleanly within the pytest ecosystem. Install it if you want coverage reports as part of your normal test workflow.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; coverage 7.10.6 or later required as of version 7.0.0 for subprocess measurement via coverage's patch system.
- Low friction installation with a pure-Python wheel.
- Actively maintained with recent releases; requires coverage and pytest as runtime dependencies, both widely used and stable.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and open-source projects without significant restrictions.
last release 2026-03-21 (146 days) · last repo commit 2026-04-24 · 2,054 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 235,924,037 downloads/mo, #169 on PyPI
Alternatives
Verify before relying
pip install pytest-cov
pytest --cov=myproj tests/
Produces a coverage report showing statement counts, missed lines, and coverage percentage for each module.- Whether the plugin's performance impact on test execution time is acceptable for large test suites.
- Specific behavior when combining coverage from multiple test runs with --cov-append in complex CI/CD pipelines.
What it is and what it does
pytest-cov is a pytest plugin that integrates code coverage measurement directly into your test runs. Instead of running coverage separately after tests, it measures coverage as pytest executes, automatically erasing and combining .coverage files, and generating reports. It handles distributed testing scenarios where pytest-xdist runs tests across multiple workers or remote interpreters, ensuring coverage data is still collected and merged correctly.
The plugin works with all features of the coverage package, either through pytest command-line options (like --cov-context for detailed test-level coverage tracking) or through coverage's config file. It maintains consistent sys.path behavior compared to running coverage run -m pytest directly, and as of version 7.0.0, it delegates subprocess measurement to coverage's built-in patch system rather than using .pth files.
Use it for
- Generate coverage reports automatically as part of your pytest test run without extra commands or configuration.
- Track coverage across distributed test runs using pytest-xdist, with results automatically combined into a single report.
- Measure coverage with detailed context (full test name including parametrization) to understand which tests exercise which code.
- Enforce minimum coverage thresholds using --cov-fail-under to fail builds when coverage drops below a target percentage.
- Append coverage data from multiple test runs to accumulate coverage across different test suites or environments.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
pytest-cov is a mature, actively maintained plugin in the top 1000 PyPI packages with no known vulnerabilities. It has low install friction, permissive MIT licensing, and solves a standard testing need—coverage measurement—cleanly within the pytest ecosystem. Install it if you want coverage reports as part of your normal test workflow.
Install
pytest-cov on PyPI
Before you install
Low friction installation with a pure-Python wheel. Actively maintained with recent releases; requires coverage and pytest as runtime dependencies, both widely used and stable.
Requires Python 3.9 or later; coverage 7.10.6 or later required as of version 7.0.0 for subprocess measurement via coverage's patch system.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and open-source projects without significant restrictions.
Quickstart
pip install pytest-cov
pytest --cov=myproj tests/
Produces a coverage report showing statement counts, missed lines, and coverage percentage for each module.
Verify before relying
- Whether the plugin's performance impact on test execution time is acceptable for large test suites.
- Specific behavior when combining coverage from multiple test runs with --cov-append in complex CI/CD pipelines.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagescoveragepluggypytest |
| Maintenance | Actively maintained 146 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 235,924,037 / month, #169 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_cov-7.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “distributed testing coverage”
- pytest-covA pytest plugin that measures code coverage during test runs,…
- pytest-coverpytest-cover is a pytest plugin for measuring code coverage, but it…
- coverageCoverage.py measures which lines of Python code are executed during…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also pytest-cagoule · pytest-cover · cov-core · covdefaults · pycobertura · pytest-json-ctrf · pytest-integration · pytest-cpp · pytest-xdist · pytest-astropy