[issue10572] Move test sub-packages to Lib/test

Terry J. Reedy report at bugs.python.org
Mon Mar 22 20:27:25 EDT 2021


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I added idlelib.idletest in May 2013 with the concurrence of Nick Coughlin, who also suggested 'idle_test' rather than just 'test'.  It currently has 72 files (66 test_xyz files for idlelib modules).

Foord's opening justification for moving package tests was "Having tests in Lib/test instead of inside the package makes it easier to grep the unittest package without grepping the tests."

I presume 'tests' refers to the unittest tests but I don't understand 'easier'.  Is recursive grepping really not optional for the grep he uses?  In any case, if Michael as package author preferred to put them in /Lib, fine.

Having package tests in the package makes it possible to grep both package code and tests together from an editor that allows searching all files in a single directory or tree.  IDLE's editor and Notepad++ are 2 examples and both have a recurse checkmark option off by default.  I routinely do both types of searches of idlelib from an IDLE editor.

I have never grepped Lib/test, but if others do, would symlinks work?

For optional packages like tkinter and idlelib, having the tests in the package means that tests are automatically omitted when the package is.  If they were moved, vendors wanting a clean test directory would have to write new code to omit or include package tests when the package is omitted or included.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue10572>
_______________________________________


More information about the Python-bugs-list mailing list