[Python-checkins] cpython (merge 3.4 -> default): Closes #22784: fix test_asyncio when the ssl module isn't available

antoine.pitrou python-checkins at python.org
Wed Nov 5 20:49:36 CET 2014


https://hg.python.org/cpython/rev/028c729714af
changeset:   93403:028c729714af
parent:      93400:ce07253e384f
parent:      93402:7e9e2b17ac6f
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Nov 05 20:48:40 2014 +0100
summary:
  Closes #22784: fix test_asyncio when the ssl module isn't available

files:
  Lib/test/test_asyncio/test_events.py |  17 ++++++++-------
  1 files changed, 9 insertions(+), 8 deletions(-)


diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -606,14 +606,15 @@
         self.assertGreater(pr.nbytes, 0)
         tr.close()
 
-    def _dummy_ssl_create_context(self, purpose=ssl.Purpose.SERVER_AUTH, *,
-                                  cafile=None, capath=None, cadata=None):
-        """
-        A ssl.create_default_context() replacement that doesn't enable
-        cert validation.
-        """
-        self.assertEqual(purpose, ssl.Purpose.SERVER_AUTH)
-        return test_utils.dummy_ssl_context()
+    if ssl:
+        def _dummy_ssl_create_context(self, purpose=ssl.Purpose.SERVER_AUTH, *,
+                                      cafile=None, capath=None, cadata=None):
+            """
+            A ssl.create_default_context() replacement that doesn't enable
+            cert validation.
+            """
+            self.assertEqual(purpose, ssl.Purpose.SERVER_AUTH)
+            return test_utils.dummy_ssl_context()
 
     def _test_create_ssl_connection(self, httpd, create_connection,
                                     check_sockname=True):

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list