File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff 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 ())
You can’t perform that action at this time.
0 commit comments