- unstable 0.4.3-1
PYTEST-WATCHER(1) | User Commands | PYTEST-WATCHER(1) |
NAME¶
pytest-watcher - Automatically rerun Python tests on code changes
DESCRIPTION¶
pytest-watcher is a tool to automatically rerun tests (using pytest by default) whenever your code changes. It is designed to be simple, effective, and compatible with most Python projects out of the box.
The watcher listens for file creation, deletion, modification, and move events. Upon detecting changes, it re-runs your tests with the most recent code state.
Unlike tools that rely on polling, pytest-watcher uses the native system file monitoring API (where supported) to efficiently detect file system events. For a list of supported platforms and caveats, see the watchdog documentation in the LINKS section.
pytest-watcher offers an interactive mode with handy keyboard shortcuts.
USAGE¶
Specify the path that you want to watch:
-
ptw .
or
-
ptw /home/repos/project
pytest-watcher passes all arguments following <path> to the test runner (defaulting to pytest), except for its own reserved options (see OPTIONS). For example:
-
ptw . -x --lf --nf
This will invoke the test runner as:
-
pytest -x --lf --nf
OPTIONS¶
The following options are reserved for pytest-watcher and will not be passed to the test runner:
- --runner
- Specify an alternative test runner.
- --patterns
- Specify file patterns to watch.
- --ignore-patterns
- Specify file patterns to ignore.
- --now
- Run tests immediately after starting the watcher.
- --delay
- Specify the delay before running tests.
- --clear
- Clear the terminal screen before each test run.
LINKS¶
Watchdog documentation: https://python-watchdog.readthedocs.io/en/stable/installation.html#supported-platforms-and-caveats
LICENSE¶
MIT
COPYRIGHT¶
Copyright (c) 2021 Olzhas Arystanov
MAN PAGE¶
Enkelena Haxhija (EnkelenaH) created this man page based on the upstream README
June 2025 | pytest-watcher 0.4.3 |