Pytest Watch
pytest-watch is a zero-config command-line interface (CLI) tool that continuously runs `pytest` and automatically re-executes tests when relevant files in your project change. It enhances the testing workflow by providing features such as audible beeps on test failures and the ability to run custom commands before or after test executions. Although it reached version 4.2.0, the project is considered unmaintained, with its official GitHub repository and PyPI page providing the primary documentation.
Warnings
- breaking The project is no longer actively maintained and has known compatibility issues with newer Python or `pytest` versions, often leading to installation or runtime errors. An alternative, `pytest-watcher`, was developed specifically because `pytest-watch` is unmaintained and problematic for many users.
- gotcha pytest-watch has been reported to fail in parsing valid `pyproject.toml` files, which can affect how project configurations are recognized and applied.
- gotcha By default, `pytest-watch` will interrupt ongoing tests if a new file system event occurs. To ensure tests complete their execution before re-running, the `--wait` command-line option must be used.
- gotcha Users have reported issues with `pytest-watch` not reliably detecting changes in subdirectories or requiring explicit configuration for them.
Install
-
pip install pytest-watch
Quickstart
cd myproject ptw