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.py.
coverage run -m pytest
You can provide the diff to skippy-cov in two ways:
-
Option 1: Use a Git Branch or Ref You can specify a branch or ref to diff against (e.g., the main branch):
skippy-cov --diff main --coverage-file .coverage
-
Option 2: Use a Diff File Generate a diff file using Git:
git diff > changes.diff
Then run:
skippy-cov --diff changes.diff --coverage-file .coverage
-
Option 1: Use a Git Branch or Ref
You can specify a branch or ref to diff against (e.g., the main branch):skippy-cov --diff main --coverage-file .coverage
If you omit the
--diffargument, it will default to the main branch as determined by your git remote (usually "main" or "master"):skippy-cov --coverage-file .coverage
But it can also be used as a pytest plugin:
pytest --skippy-cov --skippy-cov-diff changes.diff --skippy-cov-coverage-file .coverage
which would be the equivalent of doing this:
pytest $(skippy-cov --diff changes.diff --coverage-file .coverage)
Configuration
skippy-cov can be configured using command-line arguments. See skippy-cov --help for more information.
Diff Argument
--diff: Path to a diff file, or a git branch/ref to diff against.- If the argument is a path to an existing file, its contents are used as the diff.
- Otherwise, it is passed to
git diff <arg>and the output is used. - If omitted, defaults to the main branch as determined by
git remote show origin.
Example usages:
skippy-cov --diff changes.diff --coverage-file .coverageskippy-cov --diff main --coverage-file .coverageskippy-cov --coverage-file .coverage(defaults to main branch)
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.0.tar.gz.
File metadata
- Download URL: skippy_cov-0.2.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aa059c658847ad98317228ee5aade2c29bbe0167f763bb06a965a945aa00b42
|
|
| MD5 |
bbbe98c3c87967f72f208c36181c15aa
|
|
| BLAKE2b-256 |
4c5a6c46a94f1e8e86a7eee7d3e33de48ba13e1a0d5e20d78832842b20cc9acb
|
Provenance
The following attestation bundles were made for skippy_cov-0.2.0.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.0.tar.gz -
Subject digest:
4aa059c658847ad98317228ee5aade2c29bbe0167f763bb06a965a945aa00b42 - Sigstore transparency entry: 222759665
- Sigstore integration time:
-
Permalink:
Shiphero/skippy-cov@dac9688858e2ccbca173dd3800db31940a7690a7 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/Shiphero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dac9688858e2ccbca173dd3800db31940a7690a7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file skippy_cov-0.2.0-py3-none-any.whl.
File metadata
- Download URL: skippy_cov-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.5 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 |
1702489e8d862c16aa96fd274cb341b3442dfe1e883a36422b5f4cef77e51aa2
|
|
| MD5 |
350464ade86c54ecec3f5e106025b007
|
|
| BLAKE2b-256 |
9fd6fed26bbad708738c7d2f2ab4c414ae2efda3482d15102dc92b8dbf30abd4
|
Provenance
The following attestation bundles were made for skippy_cov-0.2.0-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.0-py3-none-any.whl -
Subject digest:
1702489e8d862c16aa96fd274cb341b3442dfe1e883a36422b5f4cef77e51aa2 - Sigstore transparency entry: 222759686
- Sigstore integration time:
-
Permalink:
Shiphero/skippy-cov@dac9688858e2ccbca173dd3800db31940a7690a7 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/Shiphero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dac9688858e2ccbca173dd3800db31940a7690a7 -
Trigger Event:
release
-
Statement type: