Skip to main content

Pytest plugin to only run tests affected by changes

Project description

pytest-cagoule is a pytest plugin to find which tests interact with the code you’ve just changed.

Usage

Collect coverage information using --cagoule-capture:

py.test --cagoule-capture

Then, to run the subset of tests that touch a particular file, use cagoule-select=<filename>[:line number], e.g.:

py.test --cagoule-select=path/to/file.py

If you are using git, cagoule can find the files and lines that have changes in the current working directory:

py.test --diff

or for any other diff spec that git can parse, using –diff=[spec], e.g:

py.test --diff=head~1..head

You probably want to configure your CI server to handle capturing.

Installing

Install pytest-cagoule using pip:

pip install pytest-cagoule

Caveats

Only lines executed during the test run are captured. This often excludes module level code, which is executed at import time, before the test starts.

Inspiration

Idea from nose-knows

License

MIT. See LICENSE for details

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

pytest-cagoule-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

pytest_cagoule-0.1.0-py2.py3-none-any.whl (7.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest-cagoule-0.1.0.tar.gz.

File metadata

File hashes

Hashes for pytest-cagoule-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a47bc662c2f74403bfa7fdedfe1e5132de82ce1e9f731f5f7375ae78d5082d5
MD5 d192b47a41c1dbfdf3bf9ba442c9b0a9
BLAKE2b-256 d47d9915a9eb7a00e34e9141d0d0ede01cf7f4cbdb8f158325b2514f02023a69

See more details on using hashes here.

File details

Details for the file pytest_cagoule-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_cagoule-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3e8ee76d347b6a841736d158ba2289476d71a8d803e9262d5dddbd3e0ff62c43
MD5 c2fdd22bc0221f45fac6b36620c83553
BLAKE2b-256 5000c2841cb0674aacd1a8660dc5002a8c08a9ff617c349b3eeb202fb1faa69d

See more details on using hashes here.

Supported by

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