Pytest plugin that allows the user to select the tests affected by a range of git commits
Project description
pytest-git-diff
Pytest plugin that allows the user to select the tests affected by a given range of git commits. A file is considered affected when:
- It was added/modified in between the commits.
- It imports another affected file.
Installation
pip install pytest-git-diff
Usage
This plugin adds 2 options to the pytest
CLI:
--only-affected-by
: filters the collected tests, keeping only those affected by the given commit range. This range should be in the formatFROM_REV..TO_REV
. IfTO_REV
is omitted, it defaults to 'HEAD'.--only-affected-last-commit
: has the same effect as--only-affected-by=HEAD~1..HEAD
.
Limitations
The main limitation in this plugin is that file paths must be valid Python identifier names (in particular, they can't contain dashes). That applies to every part of the path up to the working directory in which pytest
was invoked.
This issue stems from a problem in the pydeps
dependency. See https://github.com/thebjorn/pydeps/issues/24.
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
pytest_git_diff-1.0.1.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for pytest_git_diff-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4f358f6ded5a5acc1593af6b2955575f114daeaf49bef78e85da3d6359528c5 |
|
MD5 | 29a67d5bcd76bbfba4cb1e75c5caa995 |
|
BLAKE2b-256 | fa7e01e934269d1a70fea1be92e101054732656ad09e143306a37054cd7602cc |