Skip to content

Commit

Permalink
pythongh-109862: Fix test_create_subprocess_with_pidfd when it was ru…
Browse files Browse the repository at this point in the history
…n separately (pythonGH-113991)
  • Loading branch information
serhiy-storchaka authored Jan 15, 2024
1 parent 1709020 commit f8a7910
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Lib/test/test_asyncio/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,13 @@ async def in_thread():

async def main():
# asyncio.Runner did not call asyncio.set_event_loop()
with self.assertRaises(RuntimeError):
asyncio.get_event_loop_policy().get_event_loop()
with warnings.catch_warnings():
warnings.simplefilter('error', DeprecationWarning)
# get_event_loop() raises DeprecationWarning if
# set_event_loop() was never called and RuntimeError if
# it was called at least once.
with self.assertRaises((RuntimeError, DeprecationWarning)):
asyncio.get_event_loop_policy().get_event_loop()
return await asyncio.to_thread(asyncio.run, in_thread())
with self.assertWarns(DeprecationWarning):
asyncio.set_child_watcher(asyncio.PidfdChildWatcher())
Expand Down

0 comments on commit f8a7910

Please sign in to comment.