skillfed

pytest-watcher

Automatically rerun your tests on file modifications

pytest-watcher v0.6.3 1.8M downloads/30d#3,532 on PyPI
Permissive license MIT AGING released

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-watcher

uv

uv add pytest-watcher

poetry

poetry add pytest-watcher

Installing 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

Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonTopic :: Software Development :: TestingTopic :: Utilities

Tags

auto-rerun tests on file changepytest watch file changescontinuous test runnertest watcher toolpytest auto-rerun
test-automationfile-watcherdev-tools

More Utilities packages