Covers is a fast Python code coverage tool, originally based on SlipCover. This version has been re-written as a Rust / PyO3 extension for improved performance and maintainability.
Covers is a fast code coverage tool. It tracks a Python program as it runs and reports on the parts that executed and those that didn't. That can help guide your testing (showing code that isn't being tested), debugging, fuzzing or to find "dead" code.
Past code coverage tools can make programs significantly slower; it is not uncommon for them to take twice as long to execute. Covers aims to provide the same information with near-zero overhead, often almost as fast as running the original Python program.
Previous coverage tools like Coverage.py rely on
Python's tracing facilities,
which add significant overhead.
Instead, Covers uses the new
sys.monitoring API
to collect coverage information with minimal performance impact. The core data collection
is implemented in Rust for maximum efficiency.
Covers is available from PyPI. You can install it like any other Python module with
pip3 install coversYou could then run your Python script with:
python3 -m covers myscript.pyCovers can also execute a Python module, as in:
python3 -m covers -m pytest -x -vwhich starts pytest, passing it any options (-x -v in this example)
after the module name.
No plug-in is required for pytest.
Our GitHub workflows run the automated test suite on Linux, MacOS and Windows, but really it should work anywhere where CPython does.
Covers is under active development; contributions are welcome! Please also feel free to create a new issue with any suggestions or issues you may encounter.