When writing unit tests in Python you may find yourself switching back and forth between your code editor window and terminal to re-run your tests.
You can avoid this by using inotify. In short, it can re-run your tests when you change any Python files in your project. Here are some little scripts to help you do that.
First, install:
If you're using bash, add this to your ~/.bashrc and restart your terminal:
If you're using Fish, add to ~/.config/fish/config.fish and restart your terminal:
Now instead of running your tests the regular way:
Run them like so:
When the tests finish you'll see the process does not exit, and when you edit a .py file in your project the tests will automatically re-run.
Over the course of your day this will yield significant time savings!