Skip to main content

Pytest plugin to get the coverage of the new lines (based on git diff) only

Project description


With pytest_nlcov you can check the test coverage of new lines only. It will check git for added and modified lines and will compute the coverage just for those lines


pip install pytest_nlcov

Note: pytest_cov is required and will be automatically installed when it is not installed yet.

Usage with pytest

When pytest_nlcov is installed, it will be discovered by pytest and executed as last step to show you the test coverage of new lines.


Two option can be given:

  • revision
  • fail threshold


Default, the new lines are based on the git diff with master. You can specify other revisions.

pytest --nlcov-revision main

Fail Threshold

Optionally you can add a threshold to fail the tests when the coverage is below the threshold.

pytest --nlcov-fail-under 0.6

Usage without pytest

pytest_nlcov can be run without pytest. Therefor you have to run coverage first, because pytest_nlcov needs its coverage data.


Optionally a revision can be given

nlcov main

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_nlcov-0.2.0.tar.gz (5.3 kB view hashes)

Uploaded source

Built Distribution

pytest_nlcov-0.2.0-py3-none-any.whl (6.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page