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

Created on 2008-09-11 18:27 by ocean-city, last changed 2009-05-17 02:15 by ajaksu2.

Files
File name Uploaded Description Edit
test_urllib.patch ocean-city, 2008-09-11 18:27
Messages (3)
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_urllib
test test_urllib failed -- Traceback (most recent call last):
  File "/home/WhiteRabbit/python-dev/trunk/Lib/test/test_urllib.py",
line 84, in
 test_geturl
    self.assertEqual(self.returned_obj.geturl(), self.pathname)
AssertionError: 'file:///tmp/@test' != '/tmp/@test'

test_support.TESTFN is /tmp/@test on cygwin, and Lib/urllib.py(484,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/test_site.py
===================================================================
--- Lib/test/test_site.py       (revision 66385)
+++ Lib/test/test_site.py       (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"

site.py's addpackage() is doing

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

and on my cygwin, this equals to

    os.path.join(
        "/home/WhiteRabbit/python-dev/trunk/lib/test",
        "/tmp/@test.pth") #=> "/tmp/@test.pth"

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

>test_support.TESTFN is /tmp/@test on cygwin
This was false information. There was a directry named @test, so
open(TESTFN, "w+") in test_support.py 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)
History
Date User Action Args
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