diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-06-07 01:12:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-07 01:12:38 +0200 |
commit | 0eba7c39132614a5730cda6b340e18dfb2d30d14 (patch) | |
tree | fae32716d814f9eb9ecc140dfbd9f7b30f6a0922 /Lib/test/test_asyncio/test_sslproto.py | |
parent | 3ef769fcd378a7f1cda19c0dfec2e79613d79e48 (diff) | |
download | cpython-0eba7c39132614a5730cda6b340e18dfb2d30d14.tar.gz cpython-0eba7c39132614a5730cda6b340e18dfb2d30d14.zip |
bpo-33789: test_asyncio: Fix ResourceWarning (GH-7460)
* Close sockets and streams to fix ResourceWarning warnings
* Catch also OSError to hide a traceback on an expected handshake
error
Diffstat (limited to 'Lib/test/test_asyncio/test_sslproto.py')
-rw-r--r-- | Lib/test/test_asyncio/test_sslproto.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index d02d441a830..78ab1eb8223 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -604,6 +604,8 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin): server_side=True) except ssl.SSLError: pass + except OSError: + pass finally: sock.close() @@ -640,6 +642,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin): except ssl.SSLError: pass finally: + orig_sock.close() sock.close() async def client(addr): @@ -653,6 +656,8 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin): writer.write(b'B') with self.assertRaises(ssl.SSLError): await reader.readline() + + writer.close() return 'OK' with self.tcp_server(server, |