[Python-Dev] Location of tests for packages

Raymond Hettinger raymond.hettinger at gmail.com
Mon Jan 24 20:46:45 CET 2011


Right now, the tests for the unittest package are under the package directory instead of Lib/test where we have most of the other tests.

There are some other packages that do the same thing, each for their own reason.

I think we should develop a strong preference for tests going under Lib/test unless there is a very compelling reason.  We already have a similar preference for all Docs going under Doc/ and that has not proved to be an issue with any package maintainer.

* The Windows distro has an install option to exclude Lib/test.  The currrent situation with unittest works against it.
* The commingling of tests with the regular code is making it more difficult to grep code while excluding tests.
* Having packages create their little worlds within world is making it more difficult to find things. 
* For regrtest to work, there still needs to be some file in Lib/test that dispatches to the alternate test directory.

This isn't a critical issue (nothing is broken) but we're a week from another release candidate, so the new Py3.2 package organization (unittest was flat in Py3.1 and its test were under Lib/test) is about to become a de-facto decision that will be hard to undo.

I recommend moving it under Lib/test before everything is set in stone.


Raymond


P.S.  I've discussed this with Michael and his preference is against going back to the Py3.1 style where the tests were under Lib/test.  He thinks the current tree makes it easier to sync with Py2.7 and the unittest2 third-party module.  Also, he likes grepping the regular source and tests all at once.


More information about the Python-Dev mailing list