Cov Change
Cov change is a tool to help you find the changes in your code that are not covered by your tests. It uses git diff to find your changes, and coverage to find your test coverage.
Installation
pip install --upgrade pip
pip install cov-change
Usage
Assuming you've already run tests with coverage (e.g. coverage run -m pytest), you will have generated a .coverage file. To then use cov-change:
coverage json # generate a json file from the .coverage file
cov-change
By default, cov-change will compare your current branch to origin/main. The full usage is:
cov-change [diff_branch] [curr_branch] [--coverage-file COVERAGE_FILE] [-o --output OUTPUT] [-v --verbose] [-f --format {cli,markdown}] [--diff_file DIFF_FILE] [--use-coverage-diff] [-h --help]
Options
diff_branchandcurr_branchare the branches you want to compare. By default,diff_branchisorigin/mainandcurr_branchis your current commit.--coverage_file COVERAGE_FILEis the path to the coverage file. By default, it iscoverage.json.-o --output OUTPUTis the path to the output JSON file. By default, it iscoverage_change.json.-v --verbosewill print out the missing lines for each file.-f --format {cli,markdown}is the format of the output. By default, it iscliand outputs a formatted table. Ifmarkdownis passed in, it will output a markdown table.--diff_file DIFF_FILEis the path to a pre-generated diff file. If this is not passed in, thegit diffwill be run within thecov-changecommand itself. It is recommended that you do not pass this argument in.--use_coverage_diffassumes thatcov-changehas already been run once, and that the coverage change file has been generated. It will then use that diff file to generate the output.
Examples
cov-change # compare origin/main to current commit
cov-change origin/dev HEAD # compare origin/dev to the current commit
cov-change origin/dev HEAD --coverage_file my_coverage.json -v # compare origin/dev to the current commit, using my_coverage.json as the coverage file and printing out the missing lines
cov-change-check
cov-change-check checks if the generated coverage_change.json file meets requirements. If it doesn't, it will exit with a non-zero exit code. This is useful for CI/CD pipelines. The full usage is:
cov-change-check [coverage_change_file] [--total TOTAL] [--file FILE] [-h --help]
Options
coverage_change_fileis the path to the coverage change file. By default, it iscoverage_change.json.--total TOTALis the minimum total coverage change required. By default, it is 0.--file FILEis the minimum coverage change required in each file. By default, it is 0.
Examples
cov-change-check --total 80 --file 50 # check if the total coverage is at least 80%, and if each file has at least 50% coverage
Release files for cov-change 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cov_change-0.1.4.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cov_change-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / cov_change-0.1.4.tar.gz
| Download URL | cov_change-0.1.4.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c57cb3acbbd0617c53c1cc6882793278dc65c9efb5d0746c4658cd3de0eed44
|
|
BLAKE2b-256 checksum How to use checksums |
332cbcc9ed41b888c775ec226c32275a300942c545b4efa92f913421079ad98f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.0 Linux/6.2.0-1015-azure
|
Release files / cov_change-0.1.4-py3-none-any.whl
| Download URL | cov_change-0.1.4-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29f29fb9f3f4a05e0744f4f5640906a0554ae7b3a17ef0b9108df18acbb80e47
|
|
BLAKE2b-256 checksum How to use checksums |
ca5d3c3a9b1275be4656ee19174dc08e2aa1f454cf008462f42459ec1573cf41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.0 Linux/6.2.0-1015-azure
|