Supercharge Your Python TDD Workflow With pytest-watcher
If you follow the Test-driven Development practice in your Python projects, you need to run your test suite often. Having to run it manually can become tedious. You can configure handy shortcuts in your favorite IDE to make the process easier. But there is even better way using pytest-watcher
.
What is pytest-watcher
?
pytest-watcher
is a continuous test runner for Python projects that reruns your tests whenever you change a *.py
file inside your project.
It uses pytest
as a test runner but you can also configure it to use other test runners (e.g. tox
, unittest
, etc.)
Installing pytest-watcher
You can install the tool like any other Python package with pip
:
pip install pytest-watcher
Usage
Navigate to your project directory and start the pytest-watcher
.
ptw .
This will tell pytest-watcher
to start listening for filesystem events in the current directory. Now change your code and enjoy your tests restarting automatically.
Demo:
Additional usage info
Visit Github repository for additional info about using and configuring pytest-watcher