[Python-bugs-list] [ python-Bugs-798274 ] absolute import patch breaks external users of test.regrtest

SourceForge.net noreply at sourceforge.net
Mon Sep 1 10:51:31 EDT 2003


Bugs item #798274, was opened at 2003-08-31 16:39
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=798274&group_id=5470

Category: Extension Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Nicholas Riley (nriley)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: absolute import patch breaks external users of test.regrtest

Initial Comment:
I've built a test system using Python's test.regrtest 
mechanism, and it worked very well under Python 2.2.  In 
Python 2.3, the output looks like this:

test_inttypes
test_inttypes skipped -- No module named test_inttypes
test_string
test_unittest
test_unittest skipped -- No module named test_unittest
[...]

I've tracked the problem down to a change made about a 
year ago.

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/
python/dist/src/Lib/test/regrtest.py.diff?r1=1.91&r2=1.92

test.regrtest is finding the modules, but is failing to import 
them because it is prepending 'test.' to the module names, 
in a mistaken assumption that all tests will be in a package 
named test.

As it happened, I had my test modules inside a directory 
named 'test', and I tried making the directory a module and 
futzing with sys.path to get it to work, but now 
test.regrtest can't find the system implementation of 
test.test_support.  I've also now got the problem of 
namespace pollution - the "test_string" above is Python's 
version, not my version with the same name.

So, it appears non-Python users of test.regrtest are broken 
by this change in Python 2.3.  I was pretty careful to make 
sure that I was doing something supported - the docstring 
for test.regrtest.main explicitly refers to non-Python test 
suite users - and ran into some weird cases like test.* not 
being installed on Mac OS X by default, but it worked very 
well otherwise.

One potential solution would be that if 'testdir' is specified, 
test.regrtest.main() does not attempt to prepend 'test.' to 
the module names.  This seems to match pretty well with 
the spirit of the documentation for that method.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-09-01 11:51

Message:
Logged In: YES 
user_id=80475

Barry, this was your change.
Would you take a look at this bug report?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=798274&group_id=5470



More information about the Python-bugs-list mailing list