Skip to main content

Tools for coverage threshold limits

Project description

coverage threshold

A command line tool for checking coverage reports against configurable coverage minimums. Currently built for use around python's coverage

Installation

pip install coverage-threshold

also recommended:

pip install coverage

Usage

Typical execution:

coverage run -m pytest tests/  # or any test runner here
coverage json
coverage-threshold

cli command options:

> coverage-threshold --help
usage: coverage-threshold [-h] [--line-coverage-min LINE_COVERAGE_MIN]
                          [--branch-coverage-min BRANCH_COVERAGE_MIN]
                          [--combined-coverage-min COMBINED_COVERAGE_MIN]
                          [--file-line-coverage-min FILE_LINE_COVERAGE_MIN]
                          [--file-branch-coverage-min FILE_BRANCH_COVERAGE_MIN]
                          [--file-combined-coverage-min FILE_COMBINED_COVERAGE_MIN]
                          [--coverage-json COVERAGE_JSON] [--config CONFIG]

A command line tool for checking coverage reports against configurable coverage minimums

optional arguments:
  -h, --help            show this help message and exit
  --line-coverage-min LINE_COVERAGE_MIN
                        minimum global average line coverage threshold
  --branch-coverage-min BRANCH_COVERAGE_MIN
                        minimum global average branch coverage threshold
  --combined-coverage-min COMBINED_COVERAGE_MIN
                        minimum global average combined line and branch coverage threshold
  --file-line-coverage-min FILE_LINE_COVERAGE_MIN
                        the line coverage threshold for each file
  --file-branch-coverage-min FILE_BRANCH_COVERAGE_MIN
                        the branch coverage threshold for each file
  --file-combined-coverage-min FILE_COMBINED_COVERAGE_MIN
                        the combined line and branch coverage threshold for each file
  --coverage-json COVERAGE_JSON
                        path to coverage json (default: ./coverage.json)
  --config CONFIG       path to config file (default: ./pyproject.toml)

Config

the current expected config file format is toml the default config file used is pyproject.toml but and alternative path can be specified with --config

example config:

[coverage-threshold]
line_coverage_min = 95
file_line_coverage_min = 95
branch_coverage_min = 50

    [coverage-threshold.modules."src/cli/"]
    file_line_coverage_min = 40

    [coverage-threshold.modules."src/cli/my_command.py"]
    file_line_coverage_min = 100

    [coverage-threshold.modules."src/lib/"]
    file_line_coverage_min = 100
    file_branch_coverage_min = 100

    [coverage-threshold.modules."src/model/"]
    file_line_coverage_min = 100

    [coverage-threshold.modules."src/__main__.py"]
    file_line_coverage_min = 0

Each string key in config.modules is treated as a path prefix, where the longest matching prefix is used to configure the coverage thresholds for each file

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

coverage_threshold-0.5.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

coverage_threshold-0.5.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file coverage_threshold-0.5.0.tar.gz.

File metadata

  • Download URL: coverage_threshold-0.5.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.1

File hashes

Hashes for coverage_threshold-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ebdf2441ca1e66d7ac6e4bcd8e3da9d09b8e6e0a18d7522ab1d6ba60dc0ed920
MD5 01eeae27a0e87637d706a1c54ec8c0ae
BLAKE2b-256 18c4658dfcf69788d42245f0a18ef1466a4a1a8b187e8ed513864ddfb4b75151

See more details on using hashes here.

File details

Details for the file coverage_threshold-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coverage_threshold-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81ee3c1b8c1d96ffd01617faf7c2efbd19ea7104a89057222f04e5d4102794b0
MD5 bac0fe5deaefa94068dab51db5a00981
BLAKE2b-256 1ef566f8d32657296992681b7dcf421855675ea56a54654f685da41113bca68c

See more details on using hashes here.

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