[Patches] [Patch #101973] test_import.py fails on Unix when run any but the local dir
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 05 Jan 2001 08:12:04 -0800
Patch #101973 has been updated.
Project: python
Category: library
Status: Closed
Submitted by: tmick
Assigned to : jhylton
Summary: test_import.py fails on Unix when run any but the local dir
Follow-Ups:
Date: 2001-Jan-05 08:12
By: jhylton
Comment:
This was fixed by rev1.2 of test_import.py
-------------------------------------------------------
Date: 2001-Jan-04 07:46
By: gvanrossum
Comment:
Wasn't this already fixed?
-------------------------------------------------------
Date: 2000-Oct-18 16:40
By: tmick
Comment:
Make test_import.py pass when it is invoked as follows:
> ./python Lib/test/test_import.py
or
> ./python Lib/test/regrtest.py test_import
I.e. from any dir other that where test_import.py exists.
The problem was that on Unix, if a relative path to a script is given on
the command line, that path is added to sys.path and *not* the current
directory. That is fine, except that test_import.py presumed that the
current directory (in which @TESTFN.py is created) is on sys.path.
Solution:
Put the current working dir on sys.path.
-------------------------------------------------------
Date: 2000-Oct-18 16:41
By: tmick
Comment:
TIm's checkin said that this was your module Jeremy so I am assigning to
you for review.
-------------------------------------------------------
Date: 2000-Oct-18 23:10
By: tmick
Comment:
a comment from Neil:
I disagree. The test suite should not assume write access to the
current directory. It should probably create a temparary
directory using mktemp() or similar, add that to sys.path and
create files there.
Sorry about not using SF but I'm on a 14.4k modem. :(
Neil
-------------------------------------------------------
Date: 2000-Oct-18 23:19
By: tmick
Comment:
Yes, I guess I agree. Frankly *every* use of test_support.TESTFN in the
test suite should be replaced with the use of tempfile.mktemp().
-------------------------------------------------------
-------------------------------------------------------
For more info, visit:
http://sourceforge.net/patch/?func=detailpatch&patch_id=101973&group_id=5470