summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-12-16 11:50:41 -0500
committerYury Selivanov <yury@magic.io>2016-12-16 11:50:41 -0500
commitcec724927a4fa956fbfe4d85928f2773ecac9150 (patch)
tree30ae1d129df3ccfe7e34d2b41809836116e60ab4 /Lib/test/test_asyncio
parent5f25e7e11829a6d3c5498477ac047aeeaca3ec1b (diff)
downloadcpython-cec724927a4fa956fbfe4d85928f2773ecac9150.tar.gz
Issue #28990: Fix SSL hanging if connection is closed before handshake completed.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_sslproto.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index 0ca6d1bf2a..59ff0f6967 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -85,5 +85,15 @@ class SslProtoHandshakeTests(test_utils.TestCase):
# Restore error logging.
log.logger.setLevel(log_level)
+ def test_connection_lost(self):
+ # From issue #472.
+ # yield from waiter hang if lost_connection was called.
+ waiter = asyncio.Future(loop=self.loop)
+ ssl_proto = self.ssl_protocol(waiter)
+ self.connection_made(ssl_proto)
+ ssl_proto.connection_lost(ConnectionAbortedError)
+ test_utils.run_briefly(self.loop)
+ self.assertIsInstance(waiter.exception(), ConnectionAbortedError)
+
if __name__ == '__main__':
unittest.main()