diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-11-05 19:48:16 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-11-05 19:48:16 (GMT) |
commit | 50219fcd23490ab65da4ed16b9c79b82d4192858 (patch) | |
tree | c0c7294c3695dde2ad2091b36f10de494b8e563b /Lib/test | |
parent | b9b389efed16e31d657b047dd2f60817afd820ec (diff) | |
download | cpython-50219fcd23490ab65da4ed16b9c79b82d4192858.zip cpython-50219fcd23490ab65da4ed16b9c79b82d4192858.tar.gz cpython-50219fcd23490ab65da4ed16b9c79b82d4192858.tar.bz2 |
Closes #22784: fix test_asyncio when the ssl module isn't available
Diffstat (limited to 'Lib/test')
-rw-r--r-- | 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 index fe1e3ad..4fe4b4c 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -606,14 +606,15 @@ class EventLoopTestsMixin: 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): |