CoverageTestRunner for Python (python-coverage package in Python) is a wonderful little tool for measuring which parts of your program are executed while you run it. It only measures at the statement level, but even that makes it quite useful when developing unit tests. Any code not covered by a unit test is obviously not being tested.

I've been using since early this year. It's been pretty systematically the case that any code not being tested by my unit tests has at least an order of magnitude more bugs in it when it gets to production.

One thing I figured out was that it's even better if you structure you code and unit tests into pairs: the code in should be fully tested by the tests in To make this easier, I wrote a "test runner" which enforces this. It tests such pairs of modules and fails the test unless all statements in the code module are visited during the test.

I give you: CoverageTestRunner.

I've just uploaded it to Debian, so it should be through the NEW queue after some time.