Skip to main content

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:

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

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

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

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

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

[tool.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

Metadata

Release files for coverage-threshold 0.6.2

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

Source distribution (sdist)

Source distribution for coverage-threshold 0.6.2
File Size Uploaded
coverage_threshold-0.6.2.tar.gz 24.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coverage-threshold 0.6.2
File Interpreter ABI Platform
coverage_threshold-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 37.5 kB

Release files / coverage_threshold-0.6.2.tar.gz

Download URL coverage_threshold-0.6.2.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a56bfd6148a01177776f28fcabd754d1ee34ad5c112366c5e346ad1c12ad1fd8
BLAKE2b-256 checksum
How to use checksums
7ce94c71f8ed66d0bcfe0d0eba4abfa82b1394040404c4cf0ae52db6c99a865c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.19

Release files / coverage_threshold-0.6.2-py3-none-any.whl

Download URL coverage_threshold-0.6.2-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2610daf03a04c0bed7d64b9aff70616ef204c6ca989965f4fd296c351d897626
BLAKE2b-256 checksum
How to use checksums
d094511548af8257b0d7da228aeecb6a177a614aaa68009f563ac032162b1b47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.19

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.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