Pythonistas: JavaScript has us beat. Grunt and Gulp both have better support for watching file changes and automatically running your test suite. Python has done ok over the years with tools like tdaemon, rerun, and watchdog, each of which serves a solid purpose, but the tools are difficult to invoke on their own.

tdaemon offers a very usable CLI interface (tdaemon -t django) and supports tox. Unfortunately, it doesn't work well with Python 3, isn't maintained on PyPI, and doesn't keep up speedwise with the event-based tools. If I could just pip install it it'd be back in the running for sure.

rerun's ignore syntax is pretty much impossible to master. It triggers a build every time I navigate through a file using vim and it writes a .swp file, despite the extensive set of flags I pass on invocation. I give up. Also, it doesn't play well with virtualenv, at least for running scripts, and I end up passing the full path to my virtualenv binary.

watchdog is probably the best, but still requires more flags than I want to enter as I bounce between several different Django-based projects. It is, however, the backbone of my new favorite test watcher and runner, py.test.

I know py.test isn't new, but I didn't realize I could run my Django test suite from py.test without changing a line of code. From now on, I'm pip installing pytest, pytest-django, and pytest-watch in my development environments. You'll need a barebones pytest.ini (or a pytest section in your tox.ini) as well:


From there on out, though, you can just let ptw do all the work. Just start the test watcher and get to TDD-ing.