Skip to content

Commit 41a94c9

Browse files
[3.12] gh-109862: Fix test_create_subprocess_with_pidfd when it was run separately (GH-113991) (GH-114072)
(cherry picked from commit f8a7910) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent cc11c76 commit 41a94c9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Lib/test/test_asyncio/test_subprocess.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -975,8 +975,13 @@ async def in_thread():
975975

976976
async def main():
977977
# asyncio.Runner did not call asyncio.set_event_loop()
978-
with self.assertRaises(RuntimeError):
979-
asyncio.get_event_loop_policy().get_event_loop()
978+
with warnings.catch_warnings():
979+
warnings.simplefilter('error', DeprecationWarning)
980+
# get_event_loop() raises DeprecationWarning if
981+
# set_event_loop() was never called and RuntimeError if
982+
# it was called at least once.
983+
with self.assertRaises((RuntimeError, DeprecationWarning)):
984+
asyncio.get_event_loop_policy().get_event_loop()
980985
return await asyncio.to_thread(asyncio.run, in_thread())
981986
with self.assertWarns(DeprecationWarning):
982987
asyncio.set_child_watcher(asyncio.PidfdChildWatcher())

0 commit comments

Comments
 (0)