[Python-checkins] cpython (3.4): 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/7e9e2b17ac6f
changeset:   93402:7e9e2b17ac6f
branch:      3.4
parent:      93399:5c5909740026
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Nov 05 20:48:16 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