Skip to main content

pytest_nlcov

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

Installation

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.

pytest

Three options can be given:

  • revision
  • fail threshold
  • root_dir

Revision

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

pytest --cov=myproj --nlcov-revision=main

Fail Threshold

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

pytest --cov=myproj --nlcov-fail-under=0.6

Root Dir

Optionally you can set the root dir of the git repo, so the command can be run from another directory that is not the root of the repo.

pytest --cov=myproj --nlcov-root-dir=repo_dir

Note

It's important to include --cov to load the pytest_cov plugin; otherwise an error message will appear saying:

nlcov is installed, but pytest-cov is not installed, so nlcov will not be executed.

Usage without pytest

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

coverage
nlcov

Optionally a revision can be given

nlcov main

Metadata

Release files for pytest_nlcov 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest_nlcov 0.4.0
File Size Uploaded
pytest_nlcov-0.4.0.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest_nlcov 0.4.0
File Interpreter ABI Platform
pytest_nlcov-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / pytest_nlcov-0.4.0.tar.gz

Download URL pytest_nlcov-0.4.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0c4e2939cf529669615ec270c2e3bff5f796dd469998ac2f6198055e89ab2ad3
BLAKE2b-256 checksum
How to use checksums
4f3bf5963ec3f303586199a36842797d0e3c49902bd502c8622f79c263c375db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure

Release files / pytest_nlcov-0.4.0-py3-none-any.whl

Download URL pytest_nlcov-0.4.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1beb2486cea208371c0c3d3e31c8bb7e34b7f47a6dc506803a247adbf086b8d5
BLAKE2b-256 checksum
How to use checksums
c4ec9650dc8440358f4aa0f32ced8a4592a2bb54098bc8b6ed85bbef41b1c749
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page