[Distutils] Question about testing

Ronald Oussoren ronaldoussoren at mac.com
Tue Aug 17 12:35:39 CEST 2010


Hi,

What's the best way to bundle tests into a test archive for a distribution using distribute or setuptools?

My requirements:
* Tests should not be installed because the testsuite is larger than the actual package and not generally usefull
* "python setup.py develop" should also not add the testsuite to sys.path
* Some tests use extensions that are part of the testsuite
* It should be possible to use "python setup.py test" to run the testsuite 

My current directory layout is simular to the CPython tree:

* toplevel setup.py script
* Lib/ contains modules/packages
* Modules/ contains extension source
* TestSuite/ contains the unittests

The setup.py file contains a package_dir declaration:

    package_dir = { '': 'Lib', 'TestSuite': 'TestSuite' },

I also have a custom build_ext command to ensure that extensions in the testsuite get copied there during the build phase
(as if the inplace option is selected for just those extensions).

This works but feels rather fragile, and I wonder if there is a cleaner solution for meeting my requirements.

(I'm using plain unittest for the tests and will probably switch to unittest2 in the near future)

Ronald


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3567 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20100817/15749402/attachment.bin>


More information about the Distutils-SIG mailing list