https://github.com/python/cpython/commit/f8a79109d0c4f408d34d51861cc0a7c447f46d70
commit: f8a79109d0c4f408d34d51861cc0a7c447f46d70
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-01-15T09:26:49+02:00
summary:

gh-109862: Fix test_create_subprocess_with_pidfd when it was run separately 
(GH-113991)

files:
M Lib/test/test_asyncio/test_subprocess.py

diff --git a/Lib/test/test_asyncio/test_subprocess.py 
b/Lib/test/test_asyncio/test_subprocess.py
index 179c8cb8cc17cf..859d2932c33fed 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -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())

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to