Watch mode
Watch mode monitors your project for file changes and reruns only the affected tests.
Basic usage
tryke watches all .py files in the project, respecting .gitignore. When a file changes, it:
- Identifies which modules were modified
- Walks the import graph to find all tests that depend on the changed modules
- Reruns only those tests
This gives you fast feedback without rerunning the entire suite.
How affected tests are determined
tryke builds a static import graph at startup (see test discovery). When a file changes, it traces the graph forward to find every test file that transitively imports the changed module, then reruns the tests in those files.
Files with dynamic imports (importlib.import_module(), __import__()) are always included in every rerun. See discovery for details.
Filtering
All the standard filtering flags work in watch mode:
# Only watch tests matching a name pattern
tryke watch -k "math"
# Only watch tests with specific tags
tryke watch -m "fast"
# Combine filters
tryke watch -k "parse" -m "not slow"
Options
Reporter
Choose an output format:
See reporters for all formats.
Fail fast
Stop a run on the first failure:
Or after N failures:
Workers
Override the number of parallel workers (defaults to CPU count):
See concurrency for details on the worker pool.
Debouncing
File system events are debounced with a 200ms window. Rapid successive saves are coalesced into a single rerun.