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

Robert Collins 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
> at
>    http://lyorn.idyll.org/~t/transfer/SomePackage.tar.gz
> 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'
As will
#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
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20100225/0d8b243b/attachment.pgp>

More information about the testing-in-python mailing list