diff options
author | Yury Selivanov <yury@magic.io> | 2016-06-28 14:55:49 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-06-28 14:55:49 (GMT) |
commit | 7c6b3ea48c4336a83a364f588ee1a0ce71230f73 (patch) | |
tree | c2b8b21206fca7a44a7e16cd4751b59bd0c284a1 | |
parent | 7de2840508fee33ea1b0070b7eee78056ad08cfa (diff) | |
parent | 77bc04a3bcb6c207f6b48f4e3418cd6a02909696 (diff) | |
download | cpython-7c6b3ea48c4336a83a364f588ee1a0ce71230f73.zip cpython-7c6b3ea48c4336a83a364f588ee1a0ce71230f73.tar.gz cpython-7c6b3ea48c4336a83a364f588ee1a0ce71230f73.tar.bz2 |
Merge 3.5 (asyncio)
-rw-r--r-- | Lib/asyncio/sslproto.py | 1 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_sslproto.py | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index 79b201c..f0f642e 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -5,6 +5,7 @@ try: except ImportError: # pragma: no cover ssl = None +from . import base_events from . import compat from . import protocols from . import transports diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index e4121a0..8d52335 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -1,5 +1,6 @@ """Tests for asyncio/sslproto.py.""" +import logging import unittest from unittest import mock try: @@ -8,6 +9,7 @@ except ImportError: ssl = None import asyncio +from asyncio import log from asyncio import sslproto from asyncio import test_utils @@ -66,6 +68,20 @@ class SslProtoHandshakeTests(test_utils.TestCase): test_utils.run_briefly(self.loop) self.assertIsInstance(waiter.exception(), ConnectionResetError) + def test_fatal_error_no_name_error(self): + # From issue #363. + # _fatal_error() generates a NameError if sslproto.py + # does not import base_events. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + # Temporarily turn off error logging so as not to spoil test output. + log_level = log.logger.getEffectiveLevel() + log.logger.setLevel(logging.FATAL) + try: + ssl_proto._fatal_error(None) + finally: + # Restore error logging. + log.logger.setLevel(log_level) if __name__ == '__main__': unittest.main() |