Back when I did some Ruby on Rails development I was a big fan of autotest. With it I could stay in my editor while the project test suite got executed with every change.
Setup
Now that I’m working in Python I was looking for something similar and I was successful. You’ll need the following:
Then you can execute tdaemon like this in your project directory:
Usage
tdaemon.py --custom-args='--with-growl'
This will continually execute the test suite and notify you with growl about the status as you can see in this screencast:
Demo
Details
To get this working as shown in the screencast I actually had to make some changes.
First nosegrowl didn’t install well using easy_install as the images were missing. So I went ahead and did it manually:
$ hg clone http://hg.assembla.com/nosegrowl
$ cd nosegrowl/nose-growl/
$ sed -i.bak 's/growl.start/# growl.start/' nosegrowl/growler.py
$ python setup.py install
The ‘sed’ command is optional. But I don’t want to be notified when the test suite starts, only when it ends. So I uncomment the growl.start line.
Additionally to make tdaemon less noisy when working with
vim I added the swap files to the exclude list.
Open the tdaemon.py
file and edit the IGNORE_EXTENSIONS
line to look
like this:
IGNORE_EXTENSIONS = ('pyc', 'pyo', 'swp')