Issue798274
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003-08-31 21:39 by nicholas.riley, last changed 2022-04-10 16:10 by admin. This issue is now closed.
Messages (6) | |||
---|---|---|---|
msg18030 - (view) | Author: Nicholas Riley (nicholas.riley) * | Date: 2003-08-31 21:39 | |
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. |
|||
msg18031 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2003-09-01 16:51 | |
Logged In: YES user_id=80475 Barry, this was your change. Would you take a look at this bug report? |
|||
msg18032 - (view) | Author: Barry A. Warsaw (barry) * | Date: 2003-09-02 03:54 | |
Logged In: YES user_id=12800 IIRC, this patch was necessary because some tests required absolute imports and we cannot mix relative and absolute imports in the test suite. IMO, regrtest's primary mission in life is to support Python's test suite and any other use is secondary (for example, it isn't documented in the standard library manual). OTOH, you might think about contributing a patch that allows regrtest to be used outside the Python test suite, but doesn't break the absolute import requirement while in the test suite. (You might also consider adding some standard lib documentation to your patch <wink>). The other problems you mention are inherent in Python's import machinery. If you have two packages named "test" on your sys.path, Python will not by default search them both for submodules. |
|||
msg18033 - (view) | Author: Nicholas Riley (nicholas.riley) * | Date: 2003-09-17 22:53 | |
Logged In: YES user_id=34933 Thanks for the helpful response. Sorry I didn't get around to writing any documentation, but a patch is here: http://sourceforge.net/tracker/index.php? func=detail&aid=808210&group_id=5470&atid=305470 |
|||
msg18034 - (view) | Author: Barry A. Warsaw (barry) * | Date: 2003-11-21 20:47 | |
Logged In: YES user_id=12800 I'm relinquishing assignment of this issue and moving it to Python 2.4. |
|||
msg18035 - (view) | Author: Collin Winter (collinwinter) * | Date: 2007-03-12 01:10 | |
regrtest's purpose is to test Python; third-party projects wishing to use regrtest in their own test suites would do well to customize it for their particular needs. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:10:57 | admin | set | github: 39162 |
2003-08-31 21:39:13 | nicholas.riley | create |