[TIP] Guidelines for where to put tests & how to package them

C. Titus Brown ctb at msu.edu
Sat Feb 27 11:08:16 PST 2010


On Fri, Feb 26, 2010 at 06:05:43PM +0000, Michael Foord wrote:

[ ... ] 

> In Python 2.7 / 3.2 you will be able to autodiscover and run unittest  
> based tests with:
>
> python -m unittest discover
>
> See: http://docs.python.org/dev/library/unittest.html#test-discovery
>
> For Python 2.4-2.6 you can get this functionality (and all the other  
> nice new functionality in unittest) with the unittest2 package. The way  
> you use the command line is with the 'unit2' script instead of 'python  
> -m ...'. See:
>
> http://pypi.python.org/pypi/unittest2
>
> If you *just* want test discovery for unittest, without having to switch  
> to unittest2, you can use the discover module. Tests are then discovered  
> with "python -m discover":
>
> http://pypi.python.org/pypi/discover
>
> So lots of options for autodiscovery and running of unittest based tests.

Yes, and of course this is how I'd prefer to go, but it's not possible for
stock 2.4-2.6 installs.  Hence the desire to specify a single mechanism that
(mirabile visu!) would also be refractory to *future* changes and not depend
on a single module's runtime semantics -- Py4K is coming some day, folks...



More information about the testing-in-python mailing list