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. Also, tests are of course registered against the code as it was when data was captured, so no new tests will be included.
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
File details
Details for the file pytest-cagoule-0.1.1.tar.gz
.
File metadata
- Download URL: pytest-cagoule-0.1.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98dad8c1212d051881fb97aab2b89b136f91f9b8313e85588ae059a8ab8449ac |
|
MD5 | 00b569c4f49d2c4a7fba35e142227d38 |
|
BLAKE2b-256 | 8d8682f6c72ff5f78ce7491139375fb26150fbc2aad4ccea00273f924f6f6f06 |