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.

classification
Title: test_import.py fails on Unix when run any but the local dir
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: jhylton Nosy List: gvanrossum, jhylton, tmick
Priority: normal Keywords: patch

Created on 2000-10-18 23:37 by tmick, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
None tmick, 2000-10-18 23:37 None
Messages (7)
msg34682 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-10-18 23:37
 
msg34683 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-01-04 15:46
Wasn't this already fixed?
msg34684 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-01-05 16:12
This was fixed by rev1.2 of test_import.py
msg34685 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-10-18 23:40
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.
msg34686 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-10-18 23:41
TIm's checkin said that this was your module Jeremy so I am assigning to you for review.
msg34687 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-10-19 06:10
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

msg34688 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-10-19 06:19
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().
History
Date User Action Args
2022-04-10 16:02:31adminsetgithub: 33369
2000-10-18 23:37:57tmickcreate