diff options
| author | Victor Stinner <vstinner@redhat.com> | 2015-07-13 17:33:39 +0200 |
|---|---|---|
| committer | Victor Stinner <vstinner@redhat.com> | 2015-07-13 17:44:53 +0200 |
| commit | 242222facef6af710d55a7d108be23c32b58c8ac (patch) | |
| tree | 1e33208cf2e30f34a6f2c58743d6d0ca43d03d89 /tests | |
| parent | 14bdbc05ee70cf89091685561dfcbd64740454e7 (diff) | |
| download | trollius-git-242222facef6af710d55a7d108be23c32b58c8ac.tar.gz | |
Fix sslproto when ssl is not available
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_events.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test_events.py b/tests/test_events.py index c8e9605..af7113b 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -64,6 +64,11 @@ def osx_tiger(): return version < (10, 5) +def skip_if_backported_sslcontext(): + backported = getattr(asyncio, 'BACKPORT_SSL_CONTEXT', False) + return unittest.skipIf(backported, 'need ssl.SSLContext') + + ONLYCERT = data_file('ssl_cert.pem') ONLYKEY = data_file('ssl_key.pem') SIGNED_CERTFILE = data_file('keycert3.pem') @@ -894,7 +899,7 @@ class EventLoopTestsMixin(object): self.test_create_unix_server_ssl() @unittest.skipIf(ssl is None, 'No ssl module') - @unittest.skipIf(asyncio.BACKPORT_SSL_CONTEXT, 'need ssl.SSLContext') + @skip_if_backported_sslcontext() def test_create_server_ssl_verify_failed(self): proto = MyProto(loop=self.loop) server, host, port = self._make_ssl_server( @@ -928,7 +933,7 @@ class EventLoopTestsMixin(object): @unittest.skipIf(ssl is None, 'No ssl module') @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') - @unittest.skipIf(asyncio.BACKPORT_SSL_CONTEXT, 'need ssl.SSLContext') + @skip_if_backported_sslcontext() def test_create_unix_server_ssl_verify_failed(self): proto = MyProto(loop=self.loop) server, path = self._make_ssl_unix_server( |
