summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-01-15 07:55:35 (GMT)
committerGitHub <noreply@github.com>2024-01-15 07:55:35 (GMT)
commit41a94c9e7be94760baab1dcb33427d8781bea64a (patch)
tree47b7f71f66f8b15f107d010d2d32e9553fbc0147 /Lib/test
parentcc11c76da7a099bb4535ab8ca507e55263fc35b6 (diff)
downloadcpython-41a94c9e7be94760baab1dcb33427d8781bea64a.zip
cpython-41a94c9e7be94760baab1dcb33427d8781bea64a.tar.gz
cpython-41a94c9e7be94760baab1dcb33427d8781bea64a.tar.bz2
[3.12] gh-109862: Fix test_create_subprocess_with_pidfd when it was run separately (GH-113991) (GH-114072)
(cherry picked from commit f8a79109d0c4f408d34d51861cc0a7c447f46d70) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_subprocess.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index 179c8cb..859d293 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -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())