Running all unit tests

Jean-Paul Calderone exarkun at divmod.com
Sat Feb 7 00:15:20 EST 2009


On Fri, 06 Feb 2009 21:11:15 -0500, Jason Voegele <jason at jvoegele.com> wrote:
>I'm working on my first substantial Python project, and I'm following a fully
>test-first approach.  I'd like to know how Pythonistas typically go about
>running all of their tests to ensure that my application stays "green".
>
>In Ruby, I would have a Rake task so that I could say "rake test" and all
>tests would be executed.  In C or C++ I would have a make target so I could
>run all my tests with "make test".  In Java it would be an Ant task and "ant
>test".  And so forth and so on.
>
>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.

There are a bunch of tools for this.  I use trial (part of Twisted), which
will collect your tests, run them, and report the results (and has helpers
for debugging, profiling, and some other stuff) and buildbot.

Jean-Paul



More information about the Python-list mailing list