[Distutils] Custom test loader support in setuptools

Phillip J. Eby pje at telecommunity.com
Thu Mar 30 01:38:38 CEST 2006

I've just added a ``test_loader`` keyword argument to ``setup()`` in 
setuptools' Subversion edition.  This lets you specify a string of the form 
"modulename:classname" to specify an alternative to unittest:TestLoader for 
finding tests.

Note that an instance of the specified class will receive a name that comes 
from the ``test_suite`` argument, but it is free to interpret that string 
in any way it wishes.  For example, a "nose" loader class could be created 
that parses command line arguments from the test_suite string.

The default test_loader is "setuptools.command.test:ScanningLoader", which 
scans submodules/subpackages for tests as well as invoking any module-level 
"additional_tests()" functions it finds.  You can use a test_loader of 
"unittest:TestLoader" to force the old (non-scanning) behavior.  And of 
course the field is wide open for people to create new test loaders, or 
wrap other testing frameworks as test loaders.

Please see setuptools.txt in the source, under the "New and Changed 
``setup()`` Keywords" section, for more details on the ``test_loader`` argument.

More information about the Distutils-SIG mailing list