[Jython-checkins] jython: Apply jython specfic changes

alan.kennedy jython-checkins at python.org
Sat Feb 2 16:20:11 CET 2013


http://hg.python.org/jython/rev/01a1add2ad8e
changeset:   6980:01a1add2ad8e
user:        Alan Kennedy <alan at xhaus.com>
date:        Sat Feb 02 15:18:49 2013 +0000
summary:
  Apply jython specfic changes

files:
  Lib/test/test_urllib.py           |   5 ++++-
  Lib/test/test_urllib2.py          |   3 +++
  Lib/test/test_urllib2_localnet.py |  12 +++++++++++-
  3 files changed, 18 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
@@ -107,7 +107,9 @@
 
     def test_fileno(self):
         file_num = self.returned_obj.fileno()
-        self.assertIsInstance(file_num, int, "fileno() did not return an int")
+        if not test_support.is_jython:
+            self.assert_(isinstance(file_num, int),
+                         "fileno() did not return an int")
         self.assertEqual(os.read(file_num, len(self.text)), self.text,
                          "Reading on the file descriptor returned by fileno() "
                          "did not return the expected text")
@@ -238,6 +240,7 @@
         self.assertFalse(os.path.exists(tmp_file))
         self.assertRaises(IOError, urllib.urlopen, tmp_fileurl)
 
+    @unittest.skipIf(test_support.is_jython, "Required SSL support not yet available on jython")
     def test_ftp_nonexisting(self):
         self.assertRaises(IOError, urllib.urlopen,
                 'ftp://localhost/not/existing/file.py')
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -605,6 +605,7 @@
 
 class HandlerTests(unittest.TestCase):
 
+    @unittest.skipIf(test_support.is_jython, "Required SSL support not yet available on jython")
     def test_ftp(self):
         class MockFTPWrapper:
             def __init__(self, data): self.data = data
@@ -1112,6 +1113,7 @@
     def test_basic_auth_with_single_quoted_realm(self):
         self.test_basic_auth(quote_char="'")
 
+    @unittest.skipIf(test_support.is_jython, "Currently not working on jython")
     def test_basic_auth_with_unquoted_realm(self):
         opener = OpenerDirector()
         password_manager = MockPasswordManager()
@@ -1347,6 +1349,7 @@
         'something bad happened'
         """
 
+    @unittest.skip("Test is broken because of fp=None, which causes failure to call addinfourl superclass __init__")
     def test_HTTPError_interface_call(self):
         """
         Issue 15701= - HTTPError interface has info method available from URLError.
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -8,6 +8,11 @@
 
 from test import test_support
 
+if test_support.is_jython:
+    import socket
+    # Working around an IPV6 problem on Windows
+    socket._use_ipv4_addresses_only(True)
+
 mimetools = test_support.import_module('mimetools', deprecated=True)
 threading = test_support.import_module('threading')
 
@@ -21,7 +26,12 @@
     def __init__(self, server_address, RequestHandlerClass):
         BaseHTTPServer.HTTPServer.__init__(self,
                                            server_address,
-                                           RequestHandlerClass)
+                                           RequestHandlerClass,
+                                           True)
+
+        host, port = self.socket.getsockname()[:2]
+        self.server_name = socket.getfqdn(host)
+        self.server_port = port
 
         # Set the timeout of our listening socket really low so
         # that we can stop the server easily.

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list