[Python-Dev] possible backward incompatibility in test.regrtest

Tamito KAJIYAMA kajiyama at grad.sccs.chukyo-u.ac.jp
Sat Nov 29 20:24:01 EST 2003


Hi developers,

It seems that the test.regrtest module has a possible backward
incompatibility with regard to pre-Python 2.3 releases.  I have
a test suit implemented using the test.regrtest module.  In this
test suit, my own tests are invoked by a script like this:

  import os
  from test import regrtest

  regrtest.STDTESTS = []
  regrtest.main(testdir=os.getcwd())

This script runs fine with 2.2 but does not with 2.3, since
regrtest.py in Python 2.3 has the following lines in runtest()
(introduced in Revision 1.87.2.1.  See [1]):

  if test.startswith('test.'):
      abstest = test
  else:
      # Always import it from the test package
      abstest = 'test.' + test
  the_package = __import__(abstest, globals(), locals(), [])

That is, tests must be in a package named "test".  However, this
package name is already used by the standard library, and AFAIK
multiple packages with the same package name cannot exist.  In
other words, any additional tests (i.e. my own tests) have to be
put into the test package in the standard library.  Otherwise,
the additional tests won't be found.  IMHO, this change in 2.3
is not reasonable.

Unless I miss something trivial (I hope so), I'd have to give up
using the test.regrtest module.  I appreciate any comment.

Thanks,

-- 
KAJIYAMA, Tamito <kajiyama at grad.sccs.chukyo-u.ac.jp>

[1] http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Lib/test/regrtest.py?r1=1.87&r2=1.87.2.1



More information about the Python-Dev mailing list