[TIP] unittest2, distribute, and doctests

Barry Warsaw barry at python.org
Mon Jun 7 14:43:22 PDT 2010

Hey guys, I have a few quick questions about unittest2.  Apologies if these
have been discussed before.

Distribute adds the ability to run 'python setup.py test' by including the
`test_suite` keyword to your setup().  What's the best way to integrate
unittest2 and distribute to enable the former to do test discovery when run
via the setup.py?

`python setup.py test` supports a -m and -s option to filter (minimally) the
tests that are run.  Can unittest2's richer command line options be supported?
(This may be more of a distutils/setuptools/distribute question.)

unit2 -p takes shell globs, but I really like zope.testrunner's regexp-based
filters.  Any chance unittest2 will support something like that?  One of the
reasons I like zope's test discovery is because it works much better with
doctests.  E.g. I can do (after a buildout):

    % bin/test -vv -t using

and it will only run my using.txt doctest.  Note that I have a test_docs.py
module that does individual .txt doctest discovery, wrapping each one in a
DocFileSuite with appropriate optionflags, and setUp.  IWBNI unittest2
eventually grew better support for doctests.

Is it intentional that a module's load_tests() not called when unit2 -p is

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20100607/93e55608/attachment.pgp>

More information about the testing-in-python mailing list