20
20
from test .support .pty_helper import run_pty , FakeInput
21
21
from unittest .mock import patch
22
22
23
- # gh-114275: WASI fails to run asyncio tests, similar skip than test_asyncio.
24
- SKIP_ASYNCIO_TESTS = (not support .has_socket_support )
23
+ SKIP_CORO_TESTS = False
25
24
26
25
27
26
class PdbTestInput (object ):
@@ -2049,23 +2048,23 @@ def test_pdb_next_command_for_generator():
2049
2048
finished
2050
2049
"""
2051
2050
2052
- if not SKIP_ASYNCIO_TESTS :
2051
+ if not SKIP_CORO_TESTS :
2053
2052
def test_pdb_next_command_for_coroutine ():
2054
2053
"""Testing skip unwindng stack on yield for coroutines for "next" command
2055
2054
2056
- >>> import asyncio
2055
+ >>> from test.support import run_async_fn, async_yield
2057
2056
2058
2057
>>> async def test_coro():
2059
- ... await asyncio.sleep (0)
2060
- ... await asyncio.sleep (0)
2061
- ... await asyncio.sleep (0)
2058
+ ... await async_yield (0)
2059
+ ... await async_yield (0)
2060
+ ... await async_yield (0)
2062
2061
2063
2062
>>> async def test_main():
2064
2063
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
2065
2064
... await test_coro()
2066
2065
2067
2066
>>> def test_function():
2068
- ... asyncio.run (test_main() )
2067
+ ... run_async_fn (test_main)
2069
2068
... print("finished")
2070
2069
2071
2070
>>> with PdbTestInput(['step',
@@ -2088,13 +2087,13 @@ def test_pdb_next_command_for_coroutine():
2088
2087
-> async def test_coro():
2089
2088
(Pdb) step
2090
2089
> <doctest test.test_pdb.test_pdb_next_command_for_coroutine[1]>(2)test_coro()
2091
- -> await asyncio.sleep (0)
2090
+ -> await async_yield (0)
2092
2091
(Pdb) next
2093
2092
> <doctest test.test_pdb.test_pdb_next_command_for_coroutine[1]>(3)test_coro()
2094
- -> await asyncio.sleep (0)
2093
+ -> await async_yield (0)
2095
2094
(Pdb) next
2096
2095
> <doctest test.test_pdb.test_pdb_next_command_for_coroutine[1]>(4)test_coro()
2097
- -> await asyncio.sleep (0)
2096
+ -> await async_yield (0)
2098
2097
(Pdb) next
2099
2098
Internal StopIteration
2100
2099
> <doctest test.test_pdb.test_pdb_next_command_for_coroutine[2]>(3)test_main()
@@ -2110,11 +2109,11 @@ def test_pdb_next_command_for_coroutine():
2110
2109
def test_pdb_next_command_for_asyncgen ():
2111
2110
"""Testing skip unwindng stack on yield for coroutines for "next" command
2112
2111
2113
- >>> import asyncio
2112
+ >>> from test.support import run_async_fn, async_yield
2114
2113
2115
2114
>>> async def agen():
2116
2115
... yield 1
2117
- ... await asyncio.sleep (0)
2116
+ ... await async_yield (0)
2118
2117
... yield 2
2119
2118
2120
2119
>>> async def test_coro():
@@ -2126,7 +2125,7 @@ def test_pdb_next_command_for_asyncgen():
2126
2125
... await test_coro()
2127
2126
2128
2127
>>> def test_function():
2129
- ... asyncio.run (test_main() )
2128
+ ... run_async_fn (test_main)
2130
2129
... print("finished")
2131
2130
2132
2131
>>> with PdbTestInput(['step',
@@ -2163,7 +2162,7 @@ def test_pdb_next_command_for_asyncgen():
2163
2162
-> yield 1
2164
2163
(Pdb) next
2165
2164
> <doctest test.test_pdb.test_pdb_next_command_for_asyncgen[1]>(3)agen()
2166
- -> await asyncio.sleep (0)
2165
+ -> await async_yield (0)
2167
2166
(Pdb) continue
2168
2167
2
2169
2168
finished
@@ -2228,23 +2227,23 @@ def test_pdb_return_command_for_generator():
2228
2227
finished
2229
2228
"""
2230
2229
2231
- if not SKIP_ASYNCIO_TESTS :
2230
+ if not SKIP_CORO_TESTS :
2232
2231
def test_pdb_return_command_for_coroutine ():
2233
2232
"""Testing no unwindng stack on yield for coroutines for "return" command
2234
2233
2235
- >>> import asyncio
2234
+ >>> from test.support import run_async_fn, async_yield
2236
2235
2237
2236
>>> async def test_coro():
2238
- ... await asyncio.sleep (0)
2239
- ... await asyncio.sleep (0)
2240
- ... await asyncio.sleep (0)
2237
+ ... await async_yield (0)
2238
+ ... await async_yield (0)
2239
+ ... await async_yield (0)
2241
2240
2242
2241
>>> async def test_main():
2243
2242
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
2244
2243
... await test_coro()
2245
2244
2246
2245
>>> def test_function():
2247
- ... asyncio.run (test_main() )
2246
+ ... run_async_fn (test_main)
2248
2247
... print("finished")
2249
2248
2250
2249
>>> with PdbTestInput(['step',
@@ -2264,10 +2263,10 @@ def test_pdb_return_command_for_coroutine():
2264
2263
-> async def test_coro():
2265
2264
(Pdb) step
2266
2265
> <doctest test.test_pdb.test_pdb_return_command_for_coroutine[1]>(2)test_coro()
2267
- -> await asyncio.sleep (0)
2266
+ -> await async_yield (0)
2268
2267
(Pdb) next
2269
2268
> <doctest test.test_pdb.test_pdb_return_command_for_coroutine[1]>(3)test_coro()
2270
- -> await asyncio.sleep (0)
2269
+ -> await async_yield (0)
2271
2270
(Pdb) continue
2272
2271
finished
2273
2272
"""
@@ -2320,28 +2319,28 @@ def test_pdb_until_command_for_generator():
2320
2319
finished
2321
2320
"""
2322
2321
2323
- if not SKIP_ASYNCIO_TESTS :
2322
+ if not SKIP_CORO_TESTS :
2324
2323
def test_pdb_until_command_for_coroutine ():
2325
2324
"""Testing no unwindng stack for coroutines
2326
2325
for "until" command if target breakpoint is not reached
2327
2326
2328
- >>> import asyncio
2327
+ >>> from test.support import run_async_fn, async_yield
2329
2328
2330
2329
>>> async def test_coro():
2331
2330
... print(0)
2332
- ... await asyncio.sleep (0)
2331
+ ... await async_yield (0)
2333
2332
... print(1)
2334
- ... await asyncio.sleep (0)
2333
+ ... await async_yield (0)
2335
2334
... print(2)
2336
- ... await asyncio.sleep (0)
2335
+ ... await async_yield (0)
2337
2336
... print(3)
2338
2337
2339
2338
>>> async def test_main():
2340
2339
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
2341
2340
... await test_coro()
2342
2341
2343
2342
>>> def test_function():
2344
- ... asyncio.run (test_main() )
2343
+ ... run_async_fn (test_main)
2345
2344
... print("finished")
2346
2345
2347
2346
>>> with PdbTestInput(['step',
0 commit comments