mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
asyncio: Close transports in tests
* Use test_utils.run_briefly() to execute pending calls to really close transports * sslproto: mock also _SSLPipe.shutdown(), it's need to close the transport * pipe test: the test doesn't close explicitly the PipeHandle, so ignore the warning instead * test_popen: use the context manager ("with p:") to explicitly close pipes
This commit is contained in:
parent
4bf22e033e
commit
ab8848bc2a
4 changed files with 15 additions and 3 deletions
|
@ -33,6 +33,7 @@ class SslProtoHandshakeTests(test_utils.TestCase):
|
|||
waiter.cancel()
|
||||
transport = mock.Mock()
|
||||
sslpipe = mock.Mock()
|
||||
sslpipe.shutdown.return_value = b''
|
||||
sslpipe.do_handshake.side_effect = do_handshake
|
||||
with mock.patch('asyncio.sslproto._SSLPipe', return_value=sslpipe):
|
||||
ssl_proto.connection_made(transport)
|
||||
|
@ -40,6 +41,9 @@ class SslProtoHandshakeTests(test_utils.TestCase):
|
|||
with test_utils.disable_logger():
|
||||
self.loop.run_until_complete(handshake_fut)
|
||||
|
||||
# Close the transport
|
||||
ssl_proto._app_transport.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue