Selectively run tests based on the current git diff and the collected data from previous tests runs
Project description
skippy-cov
Overview
skippy-cov is a tool that optimizes your Python testing workflow by filtering tests based on code changes. It takes a diff file from git and a .coverage database (generated by coverage.py) to identify and run only the tests relevant to the modified code. This significantly reduces testing time and resources.
Usage
To use this, you first need to generate the following required files:
- Run Coverage Analysis: Generate a
.coveragedatabase usingcoverage.pyviapytest-covwith test contexts
pytest --cov=myproj --cov-context=test myproj/tests/
Then change your code and run
pytest --skippy-cov
In this case, skippy-cov will analyze the changes and run only the tests that are relevant to the modified code.
You can also use skippy-cov as a CLI on its own.
skippy-cov
that will list the tests selected.
Configuration
The inputs for skippy-cov are the coverage file (default: .coverage) and the diff information. By default, the diff is generated in the same way as a pull request (PR) on GitHub: only the changes introduced by your branch compared to the target branch are considered. This is done using the git diff <target>...HEAD (triple-dot) syntax.
You can specify the coverage file and a branch or ref to diff against (e.g., the main branch):
skippy-cov --diff main --coverage-file .coverage
or equivalently
pytest --skippy-cov --skippy-cov-diff main --skippy-cov-coverage-file .coverage
You can also provide a diff file:
git diff > changes.diff
skippy-cov --diff changes.diff --coverage-file .coverage
If you omit the --diff argument, it will default to the main branch as determined by your git remote (usually "main" or "master").
Advanced:
You may pass any valid git diff refspec to --diff, including triple-dot syntax (e.g., main...HEAD or origin/master...feature-branch). If you provide a triple-dot ref, it will be used as-is, giving you full control over the comparison range.
See skippy-cov --help for more information.
Contributing
See CONTRIBUTING.md for information on how to contribute to the project.
License
See LICENSE for licensing information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file skippy_cov-0.2.2.tar.gz.
File metadata
- Download URL: skippy_cov-0.2.2.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c94dd3c12cb046afcac5d416a5934f52fbf9cf900bbfb04f26512958a78b953d
|
|
| MD5 |
544f1ef85856c2b3ec26feb9709d2497
|
|
| BLAKE2b-256 |
10672777751785f7955130414c53e27a4fe0ae6e4025a289f21b69546470c224
|
Provenance
The following attestation bundles were made for skippy_cov-0.2.2.tar.gz:
Publisher:
release.yml on Shiphero/skippy-cov
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skippy_cov-0.2.2.tar.gz -
Subject digest:
c94dd3c12cb046afcac5d416a5934f52fbf9cf900bbfb04f26512958a78b953d - Sigstore transparency entry: 229545672
- Sigstore integration time:
-
Permalink:
Shiphero/skippy-cov@ecc38bea85855db759e3f0c2e2e4801251186510 -
Branch / Tag:
refs/tags/0.2.2 - Owner: https://github.com/Shiphero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ecc38bea85855db759e3f0c2e2e4801251186510 -
Trigger Event:
release
-
Statement type:
File details
Details for the file skippy_cov-0.2.2-py3-none-any.whl.
File metadata
- Download URL: skippy_cov-0.2.2-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fdf2418471a85d640064230e63e35fdb9c030c162122d22dcb0a4eb9a02320b
|
|
| MD5 |
3b22a2cb7de47b0e5c188f847ef8af86
|
|
| BLAKE2b-256 |
76c0fa40db4f41e823eb311ee7148f63ed44a85f4b3ec9a11264accd0cc7b41e
|
Provenance
The following attestation bundles were made for skippy_cov-0.2.2-py3-none-any.whl:
Publisher:
release.yml on Shiphero/skippy-cov
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skippy_cov-0.2.2-py3-none-any.whl -
Subject digest:
5fdf2418471a85d640064230e63e35fdb9c030c162122d22dcb0a4eb9a02320b - Sigstore transparency entry: 229545673
- Sigstore integration time:
-
Permalink:
Shiphero/skippy-cov@ecc38bea85855db759e3f0c2e2e4801251186510 -
Branch / Tag:
refs/tags/0.2.2 - Owner: https://github.com/Shiphero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ecc38bea85855db759e3f0c2e2e4801251186510 -
Trigger Event:
release
-
Statement type: