PYTEST-WATCHER(1)
π PYTEST-WATCHER π
okay bestie, gather round, because this little cutie is about to change your whole dev life. it's pytest-watcher, a tool that automatically reruns your Python tests on code changes, and yes it lives in the User Commands section of the manual like the icon it is. π
β¨ DESCRIPTION β¨
pytest-watcher is that bestie who's always watching (in a wholesome way, not a creepy way π«Ά). It automatically reruns your tests β using pytest by default β literally every time your code changes. It was designed to be simple, effective, and compatible with most Python projects out of the box. no cap. π₯
The watcher listens for file creation, deletion, modification, and move events. The moment it detects a change, it re-runs your tests against the most recent code state. slay.
Unlike tools that rely on polling (so 2019 of them π), pytest-watcher uses the native system file monitoring API β where supported β to efficiently detect file system events. So it's giving efficient, it's giving native, it's giving main character energy. For the list of supported platforms and the caveats, go peek at the watchdog documentation over in the LINKS section. π¦
Also?? pytest-watcher offers an interactive mode with handy keyboard shortcuts. obsessed. π
πΈ USAGE πΈ
First things first: tell it which path you want to watch. π
ptw .
or
ptw /home/repos/project
Now here's the tea, and it's good tea: pytest-watcher passes all arguments following path straight to the test runner (which defaults to pytest), except for its own reserved options (scoot over to OPTIONS for those). For example:
ptw . -x --lf --nf
This will invoke the test runner as:
pytest -x --lf --nf
periodt. π
π OPTIONS π
These following options are reserved for pytest-watcher itself β meaning they will not be passed along to the test runner. respect the boundaries bestie. β
--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.--notify-on-failureβ Send BEL notification on test run failure
π¦ DEBUG π¦
Something acting sus? π Set PTW_DEBUG=1 to enable debug-level logging for troubleshooting:
PTW_DEBUG=1 ptw .
π LINKS π
Watchdog documentation: https://python-watchdog.readthedocs.io/en/stable/installation.html#supported-platforms-and-caveats
π LICENSE π
MIT β the classic, the icon, the moment.
β COPYRIGHT β
Copyright (c) 2021 Olzhas Arystanov
π MAN PAGE π
Enkelena Haxhija (EnkelenaH) created this man page based on the upstream README. absolute legend behaviour, fr fr. π«Ά
okay that's the whole vibe check, you're fully caught up π go watch some files, bestie.
and with that β this was pytest-watcher 0.6.3, dated July 2026. mwah, take care of her πβ¨π
π¦ where this page comes from
- ubuntu stonking: python3-pytest-watcher 0.6.3-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms