pytest-watcher

0.6.3 · active · verified Sat Apr 11

pytest-watcher is a command-line interface (CLI) tool that automatically reruns your Python tests (using pytest by default) whenever your code changes. It is a maintained alternative to the unmaintained `pytest-watch` and is designed to streamline the test-driven development (TDD) workflow by providing continuous test feedback. The current version is 0.6.3, and it supports Unix (Linux, MacOS, BSD) and Windows.

Warnings

Install

Imports

Quickstart

Navigate to your project directory and run `ptw .` to start watching for file changes. It will automatically detect Python files (`*.py` by default) and re-run your pytest suite upon modification.

# In your project directory with pytest tests:
# Create a dummy test file (e.g., test_example.py)
# def test_addition():
#     assert 1 + 1 == 2

# Run the watcher
ptw .

view raw JSON →