mirror of
https://github.com/python/cpython.git
synced 2025-08-16 06:40:56 +00:00
[3.12] gh-109862: Fix test_create_subprocess_with_pidfd when it was run separately (GH-113991) (GH-114072)
(cherry picked from commit f8a79109d0
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
cc11c76da7
commit
41a94c9e7b
1 changed files with 7 additions and 2 deletions
|
@ -975,8 +975,13 @@ if sys.platform != 'win32':
|
|||
|
||||
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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue