summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2015-07-11 12:21:51 +0200
committerVictor Stinner <vstinner@redhat.com>2015-07-11 12:21:51 +0200
commite82d8c676a7adcd797836bd5974ced28ca8febbd (patch)
treea5aa0115600e7b78afe5a6196d0b29db2da562dc
parent2173eee4d21671139ba836f25b092b6b311cf3fb (diff)
downloadtrollius-git-e82d8c676a7adcd797836bd5974ced28ca8febbd.tar.gz
Fix Python 3.2 compat
-rw-r--r--tests/test_events.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test_events.py b/tests/test_events.py
index 8cd0ae8..c8e9605 100644
--- a/tests/test_events.py
+++ b/tests/test_events.py
@@ -653,7 +653,9 @@ class EventLoopTestsMixin(object):
with test_utils.disable_logger():
self._basetest_create_ssl_connection(conn_fut, check_sockname)
- self.assertEqual(cm.exception.reason, 'CERTIFICATE_VERIFY_FAILED')
+ # 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')
def test_create_ssl_connection(self):
@@ -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