Skip to main content

Find the last Git commit where a pytest test started failing

Project description

pytest-culprit

A CLI tool to find the last Git commit where a specific pytest test started failing.

🚀 Installation

pip install pytest-culprit

🔍 Usage

pytest-culprit 15 pytest tests/test_rewards.py::test_logic
  • 15: Number of commits to check backward from HEAD
  • pytest ...: The test command to run

🧠 What it does

  • Walks backward through Git commits
  • Runs your test command at each one
  • Stops when the test passes
  • Prints details of the last failing commit (the culprit)

📌 Example Output

📌 Starting from branch: main
▶️  Running test at commit 0a45b22 [3/15]
✅ Test started passing here.
❌ Last failing commit was:

commit f87d098
Author: Vishal Teotia <vishal@github.com>
Date:   2025-05-15

    break: tests

🧪 This commit broke: pytest tests/test_rewards.py::test_logic

⚖ License

MIT

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_culprit-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

pytest_culprit-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest_culprit-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_culprit-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pytest_culprit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ada7e87329a13abf84baf234d29c53d11a7203b59c7d294ae4f463f65673c91
MD5 8bb277adf67d75dcd245c418ebcf2120
BLAKE2b-256 2ae5618d95dfc459e60f9c50e2de9abe7d170a988f9a8bf6899560fe1e46b8d7

See more details on using hashes here.

File details

Details for the file pytest_culprit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_culprit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pytest_culprit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a2e71df40200a47af2fd53c6c7159a1053e4eef53c2308749234b3402e8ee53
MD5 4d7fb64b68f5c0af0c055486d0cb5472
BLAKE2b-256 b5cd192698232b932880703188f287ddb0339a3c2571467751f914f116fde5b1

See more details on using hashes here.

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