homepage

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_urllib2 and test_ntpath fail if path contains "\"
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Benno.Rice, BreamoreBoy, ezio.melotti, flox, orsenthil, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2010年01月10日 16:50 by flox, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
urllib2-conditionalise-path-hacking.patch Benno.Rice, 2012年08月20日 01:27 review
issue7665.patch serhiy.storchaka, 2014年10月12日 15:22 review
Messages (13)
msg97522 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010年01月10日 16:50
/tmp/py2u... → un\icode $ ./python Lib/test/regrtest.py test_urllib2
test_urllib2
test test_urllib2 failed -- Traceback (most recent call last):
 File "/tmp/py2u... → un\icode/Lib/test/test_urllib2.py", line 36, in test_trivial
 f = urllib2.urlopen(file_url)
 File "/tmp/py2u... → un\icode/Lib/urllib2.py", line 126, in urlopen
 return _opener.open(url, data, timeout)
 File "/tmp/py2u... → un\icode/Lib/urllib2.py", line 391, in open
 response = self._open(req, data)
 File "/tmp/py2u... → un\icode/Lib/urllib2.py", line 409, in _open
 '_open', req)
 File "/tmp/py2u... → un\icode/Lib/urllib2.py", line 369, in _call_chain
 result = func(*args)
 File "/tmp/py2u... → un\icode/Lib/urllib2.py", line 1260, in file_open
 return self.open_local_file(req)
 File "/tmp/py2u... → un\icode/Lib/urllib2.py", line 1297, in open_local_file
 raise URLError(msg)
URLError: <urlopen error [Errno 2] No such file or directory: '/tmp/py2u\xe2\x80\xa6 \xe2\x86\x92 un/icode/Lib/urllib2.pyc'>
1 test failed:
 test_urllib2
msg97527 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010年01月10日 17:41
Similar issue with test_ntpath.
/tmp/py2u... → un\icode $ ./python Lib/test/regrtest.py test_ntpath
test_ntpath
test test_ntpath failed -- Traceback (most recent call last):
 File "/tmp/py2u... → un\icode/Lib/test/test_ntpath.py", line 171, in test_relpath
 tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
 File "/tmp/py2u... → un\icode/Lib/test/test_ntpath.py", line 13, in tester
 %(str(fn), str(wantResult), str(gotResult))
TestFailed: ntpath.relpath("a", "../b") should return: ..\py2u... → un\icode\a but returned: ..\icode\a
1 test failed:
 test_ntpath
msg168612 - (view) Author: Benno Rice (Benno.Rice) Date: 2012年08月20日 01:27
This patch fixes the urllib2 test. I wasn't able to replicate the ntpath test failure.
This patch needs testing on Windows to make sure I haven't broken anything.
msg221854 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014年06月29日 15:59
Can someone try to reproduce these on 2.7 as I no longer have it set up. If both problems can be reproduced I think the test_urllib2 problem should be dealt with here and a new issue opened for test_ntpath.
msg227712 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014年09月27日 18:43
The ntpath test failure is replicated when the test is ran directly:
~/py/cpython1円$ ./python Lib/test/test_ntpath.py
........................s........E.....
======================================================================
ERROR: test_relpath (__main__.TestNtpath)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "Lib/test/test_ntpath.py", line 314, in test_relpath
 tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
 File "Lib/test/test_ntpath.py", line 16, in tester
 %(str(fn), str(wantResult), str(gotResult)))
test.support.TestFailed: ntpath.relpath("a", "../b") should return: ..\cpython1円\a but returned: ..1円\a
----------------------------------------------------------------------
Here is a patch with a fix of test_ntpath and with simpler fix of test_urllib2.
msg229159 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014年10月12日 15:07
Oh-oh, I didn't attached my patch and cleared my working space.
msg229161 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014年10月12日 15:08
> Oh-oh, I didn't attached my patch and cleared my working space.
Too bad. I did the same mistake yesterday :-/
msg229166 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014年10月12日 15:22
Here is an attempt to reproduce my patch.
msg231937 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014年12月01日 13:38
Ping.
msg234271 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015年01月18日 20:14
Could you please look at the patch Senthil?
msg234314 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2015年01月19日 15:34
I reviewed the patch Serhiy. It looks good to me, You can go ahead and commit. Thanks!
msg234721 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015年01月26日 08:29
New changeset 1e12c9e5bc89 by Serhiy Storchaka in branch '2.7':
Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
https://hg.python.org/cpython/rev/1e12c9e5bc89
New changeset 04fa56628830 by Serhiy Storchaka in branch '3.4':
Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
https://hg.python.org/cpython/rev/04fa56628830
New changeset 1db1cd711104 by Serhiy Storchaka in branch 'default':
Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
https://hg.python.org/cpython/rev/1db1cd711104 
msg234722 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015年01月26日 08:31
Thank for your review Senthil.
History
Date User Action Args
2022年04月11日 14:56:56adminsetgithub: 51914
2015年01月26日 08:31:46serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg234722

stage: patch review -> resolved
2015年01月26日 08:29:35python-devsetnosy: + python-dev
messages: + msg234721
2015年01月19日 15:34:18orsenthilsetassignee: orsenthil -> serhiy.storchaka
messages: + msg234314
2015年01月18日 20:14:27serhiy.storchakasetmessages: + msg234271
2014年12月01日 13:38:10serhiy.storchakasetmessages: + msg231937
2014年10月12日 15:22:19serhiy.storchakasetfiles: + issue7665.patch

messages: + msg229166
2014年10月12日 15:08:43vstinnersetmessages: + msg229161
2014年10月12日 15:07:25serhiy.storchakasetmessages: + msg229159
2014年09月27日 18:43:33serhiy.storchakasetnosy: + serhiy.storchaka

messages: + msg227712
versions: + Python 3.4, Python 3.5
2014年06月29日 15:59:58BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221854
2012年09月19日 02:09:27ezio.melottisetnosy: + vstinner

stage: needs patch -> patch review
2012年08月20日 01:27:37Benno.Ricesetfiles: + urllib2-conditionalise-path-hacking.patch

nosy: + Benno.Rice
messages: + msg168612

keywords: + patch
2010年01月10日 18:05:29orsenthilsetassignee: orsenthil
2010年01月10日 17:41:31floxsetmessages: + msg97527
title: test_urllib2 fails if path contains "\" -> test_urllib2 and test_ntpath fail if path contains "\"
2010年01月10日 17:07:26ezio.melottisetpriority: normal
nosy: + orsenthil, ezio.melotti

stage: needs patch
2010年01月10日 16:50:24floxcreate

AltStyle によって変換されたページ (->オリジナル) /