pytest-watcher
Automatically rerun your tests on file modifications
What it is and what it does
pytest-watcher is a command-line tool that monitors your Python project for file changes and automatically reruns your tests. It watches for new, modified, deleted, or moved .py files by default, though you can customize the patterns. The tool uses native system file monitoring APIs (via watchdog) instead of polling, making it efficient on supported platforms including Unix and Windows.
You run it with `ptw .` to watch your current directory, and it passes any additional arguments to pytest or your chosen test runner. It includes a configurable delay (default 0.2 seconds) to account for post-processors like code formatters, optional screen clearing, and terminal notifications on test failure. Configuration can be set in pyproject.toml, and it requires Python 3.9 or later.
Use it for:
- Rapid feedback loop during test-driven development where you want tests to run immediately after saving code
- Continuous validation of a specific directory or file pattern while refactoring
- Running alternative test runners with the same watch-and-rerun workflow
- Ignoring certain files while watching the rest of your codebase
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically reruns pytest (or another test runner) whenever your Python code changes, using native system file monitoring on supported platforms.
Yes, if you want a lightweight, low-friction way to automatically rerun tests during development. The aging maintenance status (last release 216 days ago) means you should not expect rapid bug fixes, but the package is stable and has no known vulnerabilities. Install it for active development workflows where continuous test feedback is valuable.
Install
pytest-watcher on PyPI
pip
pip install pytest-watcheruv
uv add pytest-watcherpoetry
poetry add pytest-watcherInstalling pytest-watcher
Before you install
Low install friction with only two runtime dependencies (tomli and watchdog). Maintenance status is aging—last release was 216 days ago—so expect slower response to issues, though the package is stable enough for established workflows.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal legal friction.
Quickstart
pip install pytest-watcher
ptw .
Requires Python 3.9 or later
Verify before relying
- Whether interactive mode keyboard shortcuts work reliably on all POSIX systems
- Performance characteristics when watching large codebases or many file patterns simultaneously
- Compatibility with test runners other than pytest
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — tomli, watchdog |
| Maintenance | aging — 216 days since the last release |
| First released | |
| Downloads | 1,808,295/month — #3,532 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_watcher-0.6.3-py3-none-any.whl
Keywords: pytest, watch, watcher
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytest-hot-reloadingA pytest plugin that runs a daemon to watch and…
unclear · top 15,000 on PyPI
pytest-watchRuns pytest continuously, re-executing tests…
permissive · top 5,000 on PyPI
watchgodWatches a directory for file changes and…
permissive · top 15,000 on PyPI
watchfilesWatches file system changes and triggers…
permissive · top 1,000 on PyPI
hupperHupper monitors Python source files for changes…
permissive · top 5,000 on PyPI
pywatchmanpywatchman is a Python client for Watchman, a…
permissive · top 15,000 on PyPI
pytest-retrypytest-retry is a pytest plugin that…
permissive · top 5,000 on PyPI
pytest-rerunfailuresA pytest plugin that automatically reruns…
copyleft · top 1,000 on PyPI
pyinotifyMonitors Linux filesystem events (file…
permissive · top 5,000 on PyPI
sphinx-autobuildWatches Sphinx documentation source files for…
permissive · top 5,000 on PyPI