summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorDPR <dpr-0xff@pm.me>2023-11-19 03:21:34 (GMT)
committerGitHub <noreply@github.com>2023-11-19 03:21:34 (GMT)
commit18c692946953e586db432fd06c856531a2b05127 (patch)
tree3e6f1487dcad49c0360a8e0b87d0d74c933c014a /Lib/test/test_asyncio
parent2bcc0f7d348fd978c8e7c7c377fcdcb7b050cb1d (diff)
downloadcpython-18c692946953e586db432fd06c856531a2b05127.zip
cpython-18c692946953e586db432fd06c856531a2b05127.tar.gz
cpython-18c692946953e586db432fd06c856531a2b05127.tar.bz2
gh-112186: Improve test case `test_loop_is_closed_resource_warnings` (#112187)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_streams.py9
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, [])