Skip to main content

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 .coverage database using coverage.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 --diff argument, 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 .coverage
  • skippy-cov --diff main --coverage-file .coverage
  • skippy-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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skippy_cov-0.2.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skippy_cov-0.2.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

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

Hashes for skippy_cov-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4aa059c658847ad98317228ee5aade2c29bbe0167f763bb06a965a945aa00b42
MD5 bbbe98c3c87967f72f208c36181c15aa
BLAKE2b-256 4c5a6c46a94f1e8e86a7eee7d3e33de48ba13e1a0d5e20d78832842b20cc9acb

See more details on using hashes here.

Provenance

The following attestation bundles were made for skippy_cov-0.2.0.tar.gz:

Publisher: release.yml on Shiphero/skippy-cov

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for skippy_cov-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1702489e8d862c16aa96fd274cb341b3442dfe1e883a36422b5f4cef77e51aa2
MD5 350464ade86c54ecec3f5e106025b007
BLAKE2b-256 9fd6fed26bbad708738c7d2f2ab4c414ae2efda3482d15102dc92b8dbf30abd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for skippy_cov-0.2.0-py3-none-any.whl:

Publisher: release.yml on Shiphero/skippy-cov

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page