diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-11-19 15:19:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 15:19:12 (GMT) |
commit | f521321ddf055636eb33c5b65456404762f5be62 (patch) | |
tree | de77bec2fa8f9e4bdcf4158830ba9868538071ec | |
parent | dedbd266d3dbbf460651d132a5f1d61643d9e20d (diff) | |
download | cpython-f521321ddf055636eb33c5b65456404762f5be62.zip cpython-f521321ddf055636eb33c5b65456404762f5be62.tar.gz cpython-f521321ddf055636eb33c5b65456404762f5be62.tar.bz2 |
[3.12] gh-112186: Improve test case `test_loop_is_closed_resource_warnings` (GH-112187) (#112255)
(cherry picked from commit 18c692946953e586db432fd06c856531a2b05127)
Co-authored-by: DPR <dpr-0xff@pm.me>
-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, []) |