Skip to main content

A pytest plugin to detect completely untested functions using coverage

Project description

A pytest plugin to detect completely untested functions using coverage.

Motivation

If you add pytest-everyfunc to your CI, you can prevent yourself from checking in code that adds functions without tests.

Installation

$ pip install pytest-everyfunc

Usage

$ pytest --cov=mypackage --fail-on-untested
...
tests/test_script.py ........      [100%]
mypackage/foo.py:253: untested function: rv_logpdf
mypackage/bar.py:717: untested function: norms
mypackage/baz.py:86: untested function: prior_predictive_check_plot
Exit: Untested functions found.

The output shows the functions that were not called.

If –fail-on-untested is set, then the exit code is 32 (regardless whether tests succeed).

$ echo $?
32

git hook

add to .git/hooks/pre-commit the pytest command above.

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_everyfunc-0.1.2.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file pytest_everyfunc-0.1.2.tar.gz.

File metadata

  • Download URL: pytest_everyfunc-0.1.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pytest_everyfunc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d50684674b7e8dc2af1da5388f65334cd22d63d8aebf9fa4772bd919ac69b226
MD5 f9c7abf1736dd4a552788bd4aa32f404
BLAKE2b-256 348e6d491d8989bb8d9b64c20549f33e17dd715c00ad4846a9c218224bcf9ca3

See more details on using hashes here.

Supported by

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