Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 26db297

Browse filesBrowse files
committed
Windows test fixes python#6
1 parent 1ff26c0 commit 26db297
Copy full SHA for 26db297

File tree

2 files changed

+9
-8
lines changed
Filter options

2 files changed

+9
-8
lines changed

‎Lib/test/test_urllib.py

Copy file name to clipboardExpand all lines: Lib/test/test_urllib.py
+1-1Lines 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

Copy file name to clipboardExpand all lines: Lib/test/test_urllib2.py
+8-7Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.