From fb4962f39ae6d3948c5cbc927a7d5d3fc0771fcd Mon Sep 17 00:00:00 2001 From: Ron Frederick Date: Wed, 31 Aug 2016 20:26:18 -0700 Subject: [PATCH] Fix an unclosed transport error in test_events When running the asyncio unit tests, I noticed that I was seeing the following error from test_ssl_connect_accepted_socket(): /Volumes/ronf/src/asyncio/asyncio/sslproto.py:328: ResourceWarning: unclosed transport warnings.warn("unclosed transport %r" % self, ResourceWarning) This commit fixes this error by calling close on the transport which is opened rather than calling close on the socket of the accepted connection used to create it. --- tests/test_events.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_events.py b/tests/test_events.py index e742eb71..7c901f27 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -793,7 +793,7 @@ def client(): loop.connect_accepted_socket( (lambda : proto), conn, ssl=server_ssl)) loop.run_forever() - conn.close() + proto.transport.close() lsock.close() thread.join(1)