[Python-Dev] Location of tests for packages

Michael Foord fuzzyman at voidspace.org.uk
Tue Jan 25 00:40:55 CET 2011


On 24/01/2011 19:46, Raymond Hettinger wrote:
> 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.

The tests are already under unittest in 2.7 so that change isn't "new". 
Moving the tests now makes it harder to maintain them (patches to 3.2 
won't apply to 2.7). This is discussed in issue 10572.

     http://bugs.python.org/issue10572

It isn't just unittest, it seems that all *test packages* are in their 
respective package and not Lib/test except for the json module where 
Raymond already moved the tests:

     distutils/tests
     email/test
     ctypes/test
     importlib/test
     lib2to3/tests
     sqlite3/test
     tkinter/test

So I'm a little confused as to why the focus on the *unittest* test suite.

Brett has expressed a willingness to move the importlib tests under 
Lib/test and R David Murray would *like* to move the email tests there 
(but hasn't). Barry is -0 and so am I. It generally makes a few things 
slightly harder for me but not much. If we make a general policy 
decision to move all package tests out of their packages and into 
Lib/test (and actually do it) then fine, but I'm not overjoyed with a 
unilateral decision that unittest is special in this regard... :-)

All the best,

Michael
> 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.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk


-- 
http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html



More information about the Python-Dev mailing list