Skip to content

Commit 26db297

Browse files
committed
Windows test fixes python#6
1 parent 1ff26c0 commit 26db297

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Lib/test/test_urllib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ def test_url2pathname_win(self):
15751575
self.assertEqual(fn('///C|/path/to/file'), 'C:\\path\\to\\file')
15761576
self.assertEqual(fn("///C|/foo/bar/spam.foo"), 'C:\\foo\\bar\\spam.foo')
15771577
# Non-ASCII drive letter
1578-
self.assertEqual(fn("///\u00e8|/"), "u00e8:\\")
1578+
self.assertEqual(fn("///\u00e8|/"), "\u00e8:\\")
15791579
# UNC paths
15801580
self.assertEqual(fn('//server/path/to/file'), '\\\\server\\path\\to\\file')
15811581
self.assertEqual(fn('////server/path/to/file'), '\\\\server\\path\\to\\file')

Lib/test/test_urllib2.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -823,14 +823,15 @@ def test_file(self):
823823
urls = [
824824
"file://localhost%s" % urlpath,
825825
"file://%s" % urlpath,
826-
"file://%s%s" % (socket.gethostbyname('localhost'), urlpath),
827826
]
828-
try:
829-
localaddr = socket.gethostbyname(socket.gethostname())
830-
except socket.gaierror:
831-
localaddr = ''
832-
if localaddr:
833-
urls.append("file://%s%s" % (localaddr, urlpath))
827+
if os.name == 'nt':
828+
urls.append("file://%s%s" % (socket.gethostbyname('localhost'), urlpath))
829+
try:
830+
localaddr = socket.gethostbyname(socket.gethostname())
831+
except socket.gaierror:
832+
localaddr = ''
833+
if localaddr:
834+
urls.append("file://%s%s" % (localaddr, urlpath))
834835

835836
for url in urls:
836837
f = open(TESTFN, "wb")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy