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

Uploaded Source

File details

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

File metadata

  • Download URL: pytest_everyfunc-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 c937e3e98b76d59bba8a0252405d4d1e5b32f9e1ae6316b45734d70f6c7de341
MD5 69c3f22b0b5543b7b75c5d1792b65f79
BLAKE2b-256 ca285688ef79a1ae33675244a5dc669c42dad986e045177c66373f84c1bcfe86

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