Title: if TESTFN == "/tmp/@test", some tests fail
Type: behavior Stage: resolved
Components: Tests Versions: Python 2.6
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: littleq0903, ocean-city, r.david.murray
Priority: normal Keywords: patch

Created on 2008-09-11 18:27 by ocean-city, last changed 2013-03-18 07:15 by r.david.murray. This issue is now closed.

File name Uploaded Description Edit
test_urllib.patch ocean-city, 2008-09-11 18:27
Messages (5)
msg73047 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-11 18:27
test_urllib's test_geturl fails with following messege.

test test_urllib failed -- Traceback (most recent call last):
  File "/home/WhiteRabbit/python-dev/trunk/Lib/test/",
line 84, in
    self.assertEqual(self.returned_obj.geturl(), self.pathname)
AssertionError: 'file:///tmp/@test' != '/tmp/@test'

test_support.TESTFN is /tmp/@test on cygwin, and Lib/,485)
specially cares about leading slash. 

            if file[:1] == '/':
                urlfile = 'file://' + file

If this is geturl()'s design, probably test should be changed like
attached patch.
msg73051 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-11 18:58
I cannot create patch now, but test_site error comes from same reason.
>test_support.TESTFN is /tmp/@test on cygwin

After I applied following adhok patch, test passed.

Index: Lib/test/
--- Lib/test/       (revision 66385)
+++ Lib/test/       (working copy)
@@ -126,7 +126,7 @@
 class PthFile(object):
     """Helper class for handling testing of .pth files"""

-    def __init__(self, filename_base=TESTFN, imported="time",
+    def __init__(self, filename_base="@test", imported="time",
                     good_dirname="__testdir__", bad_dirname="__bad"):
         """Initialize instance variables"""
         self.filename = filename_base + ".pth"'s addpackage() is doing

    fullname = os.path.join(sitedir, name)

and on my cygwin, this equals to

        "/tmp/@test.pth") #=> "/tmp/@test.pth"

probably this is not good. (I cannot figure out what is doing
msg73055 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-11 20:57
Same happend in too.

>test_support.TESTFN is /tmp/@test on cygwin
This was false information. There was a directry named @test, so
open(TESTFN, "w+") in failed, "/tmp/@test" was used instead.

Several tests seem to assume TESTFN is relative path (filename?), so
maybe should we use @test2 as TESTFN if @test is not writable and vise
versa? (Or simply test fails if @test is not writable)
msg184418 - (view) Author: Colin Su (littleq0903) * Date: 2013-03-18 03:38
TESTFN will be in format "@test_{pid}_tmp" instead of "@test" right now.

So it's not easy to have exactly the same name "@test_{pid}_tmp" in case if you put "@test_{X}_tmp" (for X in range(1,100000)) so many files into the top folder.

does it need to keep open anymore?
msg184434 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-03-18 07:15
To clarify Colin's comment (we worked on this at the sprints), in 2.7 and later regrtest no longer will generate a TESTFN that starts with /tmp in any circumstance, so that includes cygwin.  (Instead regrtest creates a temporary directory in which the tests are run.)  So, indeed, this bug is now out of date.
Date User Action Args
2013-03-18 07:15:24r.david.murraysetstatus: open -> closed
resolution: out of date
messages: + msg184434

stage: needs patch -> resolved
2013-03-18 03:38:12littleq0903setnosy: + littleq0903
messages: + msg184418
2009-05-17 02:15:31ajaksu2setpriority: normal
nosy: + r.david.murray

type: behavior
stage: needs patch
2008-09-11 20:57:28ocean-citysettitle: test_urllib fails on cygwin -> if TESTFN == "/tmp/@test", some tests fail
messages: + msg73055
versions: - Python 2.5, Python 3.0
2008-09-11 18:58:22ocean-citysetmessages: + msg73051
2008-09-11 18:27:20ocean-citycreate