Registry / testing / pytest-watcher

pytest-watcher

JSON →
library0.6.3pypypi✓ verified 25d ago

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.

pip install pytest-watcher
INSTALL
IMPORT
SIG · PYTEST-WATCHER
P
pytest-watcher
testingpythonv0.6.3
Install
1.7s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ptw
Run from command line: ptw .
pytest-watcher is primarily a CLI tool and is not typically imported into Python code for its main functionality.

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 .
ptw --version
Debug
Known issues
breakingpytest-watcher is a modern, maintained alternative to the older, unmaintained `pytest-watch` (also known as `ptw`). If you were using `pytest-watch`, be aware that it had known issues (e.g., with `pyproject.toml` parsing) which `pytest-watcher` aims to resolve. Migrate to `pytest-watcher` for ongoing support and compatibility.
fix
Uninstall `pytest-watch` and install `pytest-watcher` (`pip install pytest-watcher`). Update any scripts or aliases to use the new tool if you were relying on specific behaviors of the old one.
affects: All versions (when migrating from pytest-watch)
gotchaArguments passed to `ptw` are either consumed by `pytest-watcher` itself or forwarded to the underlying test runner (pytest by default). Ensure you understand which arguments are reserved by `pytest-watcher` (e.g., `--runner`, `--patterns`, `--ignore-patterns`, `--delay`, `--clear`, `--now`, `--notify-on-failure`) and which will be passed to `pytest` (typically all arguments after a directory path or a `--` separator).
fix
Consult `ptw --help` to see `pytest-watcher`'s specific options. To pass arguments directly to pytest, separate them with `--`, e.g., `ptw . -- -x --lf`.
affects: All versions
gotchapytest-watcher introduces a short default delay (0.2 seconds) before triggering a test run after a file change. This is intentional to debounce rapid saves (e.g., by IDE formatters) and allow post-processors to complete. If you require immediate test execution, this delay might be unexpected.
fix
To disable or adjust the delay, use the `--delay` option. For immediate execution, you can set `--delay 0` (though this might lead to multiple test runs with very quick, successive saves).
affects: All versions
Upgrade
Version history
0.6.3latest on PyPI · released Jan 10, 2026
Audit
Dependencies
pytestrequiredIt acts as a continuous test runner for pytest.
watchdogrequiredIt uses the watchdog library for efficient filesystem event monitoring.
Agent activity
41 hits · last 30 days
node
38
Bingbot
1
Resources
pytest-watcher — pip install pytest-watcher · libregistry