Skip to content

Commit 297a684

Browse files
Add test
1 parent 490a6d9 commit 297a684

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Lib/test/test_pdb.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,6 +2059,29 @@ def test_pdb_next_command_for_generator():
20592059
"""
20602060

20612061
if not SKIP_CORO_TESTS:
2062+
def test_pdb_asynctask():
2063+
"""Testing $_asynctask is accessible in async context
2064+
2065+
>>> import asyncio
2066+
2067+
>>> async def test():
2068+
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
2069+
2070+
>>> def test_function():
2071+
... asyncio.run(test())
2072+
2073+
>>> with PdbTestInput([ # doctest: +ELLIPSIS
2074+
... '$_asynctask',
2075+
... 'continue',
2076+
... ]):
2077+
... test_function()
2078+
> <doctest test.test_pdb.test_pdb_asynctask[1]>(2)test()
2079+
-> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
2080+
(Pdb) $_asynctask
2081+
<Task pending name='Task-1' coro=<test() running at <doctest test.test_pdb.test_pdb_asynctask[1]>:2> ...
2082+
(Pdb) continue
2083+
"""
2084+
20622085
def test_pdb_next_command_for_coroutine():
20632086
"""Testing skip unwinding stack on yield for coroutines for "next" command
20642087

0 commit comments

Comments
 (0)