[TIP] Guidelines for where to put tests & how to package them
robertc at robertcollins.net
Wed Feb 24 23:03:24 PST 2010
On Wed, 2010-02-24 at 21:01 -0800, C. Titus Brown wrote:
> Hi all,
> Full source at http://github.com/ctb/SomePackage or downloadable
> Comments? Thoughts? Complaints? Issues I missed?
The boilerplate 'run' isn't needed.
Rather than 'get_suite' define 'test_suite', then
$ trial somepackage.tests will 'just work'
#actually, there is a bug open on this one:
$ python -m unittest somepackage.tests.test_suite
# but this works:
$ python -m subunit.run somepackage.tests.test_suite
$ python -m testtools.run somepackage.tests.test_suite
If instead you define the load_tests hook, python 2.7 and 3.1 will work
$ python -m unittest somepackage # discovery ftw
In older pythons the discover module can do this for you as well, I
don't know its command line interface tough.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: This is a digitally signed message part
More information about the testing-in-python