mirror of
https://github.com/python/cpython
synced 2024-10-14 10:18:12 +00:00
gh-112186: Improve test case test_loop_is_closed_resource_warnings
(#112187)
This commit is contained in:
parent
2bcc0f7d34
commit
18c6929469
|
@ -1122,13 +1122,10 @@ async def inner(httpd):
|
||||||
self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
|
self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
|
||||||
|
|
||||||
with test_utils.run_test_server() as httpd:
|
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))
|
self.loop.run_until_complete(inner(httpd))
|
||||||
# This exception is caused by `self.loop.stop()` as expected.
|
gc.collect()
|
||||||
except RuntimeError:
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
gc.collect()
|
|
||||||
|
|
||||||
self.assertEqual(messages, [])
|
self.assertEqual(messages, [])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue