diff options
Diffstat (limited to 'Lib/test/test_asyncio/test_streams.py')
-rw-r--r-- | Lib/test/test_asyncio/test_streams.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index ccb7dbf..b408cd1 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -1122,13 +1122,10 @@ os.close(fd) self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx)) with test_utils.run_test_server() as httpd: - try: + with self.assertRaises(RuntimeError): + # This exception is caused by `self.loop.stop()` as expected. self.loop.run_until_complete(inner(httpd)) - # This exception is caused by `self.loop.stop()` as expected. - except RuntimeError: - pass - finally: - gc.collect() + gc.collect() self.assertEqual(messages, []) |