Skip to content

Commit d9ed42b

Browse files
authored
gh-128201: Fix DeprecationWarning in test_pdb (#128202)
1 parent 418114c commit d9ed42b

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

Lib/test/test_pdb.py

+4-16
Original file line numberDiff line numberDiff line change
@@ -2065,10 +2065,7 @@ def test_pdb_next_command_for_coroutine():
20652065
... await test_coro()
20662066
20672067
>>> def test_function():
2068-
... loop = asyncio.new_event_loop()
2069-
... loop.run_until_complete(test_main())
2070-
... loop.close()
2071-
... asyncio.set_event_loop_policy(None)
2068+
... asyncio.run(test_main())
20722069
... print("finished")
20732070
20742071
>>> with PdbTestInput(['step',
@@ -2129,10 +2126,7 @@ def test_pdb_next_command_for_asyncgen():
21292126
... await test_coro()
21302127
21312128
>>> def test_function():
2132-
... loop = asyncio.new_event_loop()
2133-
... loop.run_until_complete(test_main())
2134-
... loop.close()
2135-
... asyncio._set_event_loop_policy(None)
2129+
... asyncio.run(test_main())
21362130
... print("finished")
21372131
21382132
>>> with PdbTestInput(['step',
@@ -2250,10 +2244,7 @@ def test_pdb_return_command_for_coroutine():
22502244
... await test_coro()
22512245
22522246
>>> def test_function():
2253-
... loop = asyncio.new_event_loop()
2254-
... loop.run_until_complete(test_main())
2255-
... loop.close()
2256-
... asyncio._set_event_loop_policy(None)
2247+
... asyncio.run(test_main())
22572248
... print("finished")
22582249
22592250
>>> with PdbTestInput(['step',
@@ -2350,10 +2341,7 @@ def test_pdb_until_command_for_coroutine():
23502341
... await test_coro()
23512342
23522343
>>> def test_function():
2353-
... loop = asyncio.new_event_loop()
2354-
... loop.run_until_complete(test_main())
2355-
... loop.close()
2356-
... asyncio._set_event_loop_policy(None)
2344+
... asyncio.run(test_main())
23572345
... print("finished")
23582346
23592347
>>> with PdbTestInput(['step',

0 commit comments

Comments
 (0)