Running all unit tests

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Feb 7 04:29:30 CET 2009


Jason Voegele <jason at jvoegele.com> writes:

> What's the recommended approach for Python programs? I'm sure I
> could write a shell script (or a Python script even) that scans my
> "test" directory for test cases and runs them, but I'm wondering if
> there's something already built in that could do this for me.

The lack of a built-in “collect and run all the tests in this working
tree” in the Python unit test system is a known problem; discussions
are ongoing what to do about it.

Meanwhile, the third-party ‘nose’ system
<URL:http://somethingaboutorange.com/mrl/projects/nose/> provides this
and much more, while remaining compatible with both testing systems in
the standard library.

I generally set up a ‘test’ target in my Makefile, such that it will
use ‘nosetests’ to collect and run all the tests; then I just run
‘make test’ in a loop that is triggered by any filesystem change in my
project working tree.

-- 
 \        “I have a microwave fireplace in my house. The other night I |
  `\   laid down in front of the fire for the evening in two minutes.” |
_o__)                                                   —Steven Wright |
Ben Finney



More information about the Python-list mailing list