Examples of how to collect coverage in `pytest` using `pytest-cov`.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Pytest code coverage examples

This repository demonstrates various ways of collecting code coverage using pytest with pytest-cov (which leverages coverage.py) against the local in-src package and also against installed versions of the package. We look at two common project layouts: the first, the basic_layout where the package resides at the root of the project directory, and the src_layout where the package resides in a src subdirectory of the project directory.

After getting your environment set up, head over to the example

This repository serves as an accompaniment to my blog post on collecting code coverage in python

Environment set up

To test these examples you'll need python 3.6+ and you'll want to set up a virtualenv:

$ python -m venv .venv
$ pip install -r requirements.txt