[Jython-checkins] jython: Fix failures in test.test_urllib on Windows.
jeff.allen
jython-checkins at python.org
Sun Dec 11 02:59:53 EST 2016
https://hg.python.org/jython/rev/83c87b2ee303
changeset: 7983:83c87b2ee303
user: Jeff Allen <ja.py at farowl.co.uk>
date: Sat Dec 10 23:36:04 2016 +0000
summary:
Fix failures in test.test_urllib on Windows.
Ensure urllib imports nturl2path. (For this we need our own copy.)
Also enable the test of Windows-specific URI mangling.
files:
Lib/test/test_urllib.py | 6 +++++-
Lib/urllib.py | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -13,6 +13,10 @@
from test import test_support
from base64 import b64encode
+# Work out this is Windows, even for Jython.
+WINDOWS = sys.platform == 'win32' or (
+ sys.platform[:4] == 'java' and os._name == 'nt')
+
def hexescape(char):
"""Escape char as RFC 2396 specifies"""
@@ -841,7 +845,7 @@
"url2pathname() failed; %s != %s" %
(expect, result))
- @unittest.skipUnless(sys.platform == 'win32',
+ @unittest.skipUnless(WINDOWS,
'test specific to the nturl2path library')
def test_ntpath(self):
given = ('/C:/', '///C:/', '/C|//')
diff --git a/Lib/urllib.py b/Lib/urllib.py
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -44,8 +44,12 @@
MAXFTPCACHE = 10 # Trim the ftp cache beyond this size
+# Work out this is Windows, even for Jython.
+WINDOWS = sys.platform == 'win32' or (
+ sys.platform[:4] == 'java' and os._name == 'nt')
+
# Helper for non-unix systems
-if os.name == 'nt':
+if WINDOWS:
from nturl2path import url2pathname, pathname2url
elif os.name == 'riscos':
from rourl2path import url2pathname, pathname2url
--
Repository URL: https://hg.python.org/jython
More information about the Jython-checkins
mailing list