diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index a0ed5ab7986768..5a22232c00a36a 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -37,8 +37,7 @@ def tearDown(self): # just in case if we have transport close callbacks test_utils.run_briefly(self.loop) - self.loop.close() - gc.collect() + # set_event_loop() takes care of closing self.loop in a safe way super().tearDown() def _basetest_open_connection(self, open_connection_fut): @@ -1102,6 +1101,8 @@ async def handle_echo(reader, writer): self.assertEqual(messages[0]['message'], 'Unhandled exception in client_connected_cb') + # Break explicitly reference cycle + messages = None if __name__ == '__main__':