Skip to content

Commit f521321

Browse files
[3.12] gh-112186: Improve test case test_loop_is_closed_resource_warnings (GH-112187) (#112255)
(cherry picked from commit 18c6929) Co-authored-by: DPR <[email protected]>
1 parent dedbd26 commit f521321

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Lib/test/test_asyncio/test_streams.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1122,13 +1122,10 @@ async def inner(httpd):
11221122
self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
11231123

11241124
with test_utils.run_test_server() as httpd:
1125-
try:
1125+
with self.assertRaises(RuntimeError):
1126+
# This exception is caused by `self.loop.stop()` as expected.
11261127
self.loop.run_until_complete(inner(httpd))
1127-
# This exception is caused by `self.loop.stop()` as expected.
1128-
except RuntimeError:
1129-
pass
1130-
finally:
1131-
gc.collect()
1128+
gc.collect()
11321129

11331130
self.assertEqual(messages, [])
11341131

0 commit comments

Comments
 (0)