February 2015

Run tests when they are saved

Submitted by michael on Fri, 02/20/2015 - 16:40

Python's watchdog module includes watchmedo, a command that watches files or directories. I like to use it to automatically run a test when the test is saved.

$ watchmedo shell-command --patterns="*.py" --recursive --command='echo "${watch_src_path}"; python "${watch_src_path}"' tests/

Hint: $ python3 -m pip install -U watchdog