Skip to main content

pytest-git-diff

Test Workflow Status PyPI Version

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 format FROM_REV..TO_REV. If TO_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.

Release files for pytest-git-diff 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-git-diff 1.0.1
File Size Uploaded
pytest_git_diff-1.0.1.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-git-diff 1.0.1
File Interpreter ABI Platform
pytest_git_diff-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / pytest_git_diff-1.0.1.tar.gz

Download URL pytest_git_diff-1.0.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8fd68ee59b384fb25323330f64dd3ff6a4480effdca88dbe171d33dfd07bbb22
BLAKE2b-256 checksum
How to use checksums
5a096725a7a10120a8b07d36b8d7a4693f8857b8477df10f04574ec70f278fa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1016-azure

Release files / pytest_git_diff-1.0.1-py3-none-any.whl

Download URL pytest_git_diff-1.0.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4f358f6ded5a5acc1593af6b2955575f114daeaf49bef78e85da3d6359528c5
BLAKE2b-256 checksum
How to use checksums
fa7e01e934269d1a70fea1be92e101054732656ad09e143306a37054cd7602cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1016-azure

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page