Fix Python 3.2 compat

This commit is contained in:
Victor Stinner
2015-07-11 12:21:51 +02:00
parent 2173eee4d2
commit e82d8c676a

View File

@@ -653,6 +653,8 @@ class EventLoopTestsMixin(object):
with test_utils.disable_logger():
self._basetest_create_ssl_connection(conn_fut, check_sockname)
# Test for Python 3.2
if hasattr(ssl.SSLError, 'reason'):
self.assertEqual(cm.exception.reason, 'CERTIFICATE_VERIFY_FAILED')
@unittest.skipIf(ssl is None, 'No ssl module')
@@ -910,7 +912,7 @@ class EventLoopTestsMixin(object):
with mock.patch.object(self.loop, 'call_exception_handler'):
with test_utils.disable_logger():
with self.assertRaisesRegex(ssl.SSLError,
'certificate verify failed '):
'certificate verify failed'):
self.loop.run_until_complete(f_c)
# execute the loop to log the connection error
@@ -945,7 +947,7 @@ class EventLoopTestsMixin(object):
with mock.patch.object(self.loop, 'call_exception_handler'):
with test_utils.disable_logger():
with self.assertRaisesRegex(ssl.SSLError,
'certificate verify failed '):
'certificate verify failed'):
self.loop.run_until_complete(f_c)
# execute the loop to log the connection error