← Back to team overview

yardbirds team mailing list archive

Re: On Testing

 

Well, as of revision 174, we now have 100% test coverage.  I've abused
some "#pragma: nocover" comments on a couple of just-in-case situations
that properly-written apps shouldn't encounter, but that can be cleared
up later.

The interesting thing is that I added this autotest script, which helped
immensely while I was working toward 100% coverage:
http://bazaar.launchpad.net/%7Espacehobo/yardbird/trunk/annotate/head%3A/autotest.py

It uses the python interface to the Linux kernel "inotify" system, so
that it can ask the kernel to alert you every time a file is modified
instead of constantly scrambling all over the directory tree running
stat() on all the inodes it cares about.

So whenever a file ending in '.py' is modified, it runs the unit tests.
If the tests fail, it just alerts the user with a gnome/dbus/whatever
popup notification, but if they succeed it goes on to run a coverage
report as well.

This is really handy because all you have to do is save your work and
within two seconds you have feedback on whether or not you're in good
shape.

So I've moved the test_coverage script over to "precommit", where my
bazaar plugin will prevent a commit if tests fail or coverage is
incomplete.  This basically means that I won't merge into trunk unless
tests are in order.  That doesn't mean I necessarily expect all
contributors to write the tests, and I'll probably fill in gaps myself
if people aren't comfortable with it.

What I'd like from folks here is if you could take a look at
http://bazaar.launchpad.net/%7Espacehobo/yardbird/trunk/annotate/head%3A/iotower/tests.py
and see if any of those examples seem bogus to you in terms of how an
infobot ought to behave.  I've done some paving of cowpaths, there, and
the first step to fixing those sorts of misfeatures is to adjust the
tests.

-- 
	01234567 <- The amazing* Indent-O-Meter!
        ^
*: Indent-O-Meter may not actually amaze.



References