Sometimes unit tests take more than a few seconds to run, especially if they involve training a small test corpus in some way or other. This can be dangerous for my focus. "I'll just check my email while I'm waiting for this test to complete." are famous last words that can lead to a slow development cycle. See compiling.

So, I started queuing a sound file to play after each test finished. This way I would be alerted immediately, rather than relying on polling.

Recently Zooko helped me improve this system by adding the feature of switching the file to play based on the test results.

Currently, I have the following alias in my .bash_aliases file:


alias testbell='X=$? ; if [ $X = 0 ] ; then mplayer -really-quiet -volume 50 ~/chimes3.mp3 ;
else mplayer -really-quiet ~/gong.mp3 ; fi'
The -really-quiet flag is about verbosity, not volume, and the -volume 50 is just because my chimes file is much louder than my gong file.

So today, for example, I've been running:


time python -m unittest code.error_insertion.test.test_RealWordErrorChannel.RealWordErrorChannelTest ;
testbell

A friend told me it sounds like there is a fairy somewhere intermittently trying to escape.