mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-121468: Add current asyncio task as a convenience variable in pdb (#124367)
This commit is contained in:
parent
c107b15ab8
commit
27fc62cf4f
5 changed files with 49 additions and 3 deletions
|
@ -16,7 +16,7 @@ import zipfile
|
|||
from contextlib import ExitStack, redirect_stdout
|
||||
from io import StringIO
|
||||
from test import support
|
||||
from test.support import force_not_colorized, os_helper
|
||||
from test.support import force_not_colorized, has_socket_support, os_helper
|
||||
from test.support.import_helper import import_module
|
||||
from test.support.pty_helper import run_pty, FakeInput
|
||||
from test.support.script_helper import kill_python
|
||||
|
@ -2059,6 +2059,30 @@ def test_pdb_next_command_for_generator():
|
|||
"""
|
||||
|
||||
if not SKIP_CORO_TESTS:
|
||||
if has_socket_support:
|
||||
def test_pdb_asynctask():
|
||||
"""Testing $_asynctask is accessible in async context
|
||||
|
||||
>>> import asyncio
|
||||
|
||||
>>> async def test():
|
||||
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
|
||||
|
||||
>>> def test_function():
|
||||
... asyncio.run(test())
|
||||
|
||||
>>> with PdbTestInput([ # doctest: +ELLIPSIS
|
||||
... '$_asynctask',
|
||||
... 'continue',
|
||||
... ]):
|
||||
... test_function()
|
||||
> <doctest test.test_pdb.test_pdb_asynctask[1]>(2)test()
|
||||
-> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
|
||||
(Pdb) $_asynctask
|
||||
<Task pending name='Task-1' coro=<test() running at <doctest test.test_pdb.test_pdb_asynctask[1]>:2> ...
|
||||
(Pdb) continue
|
||||
"""
|
||||
|
||||
def test_pdb_next_command_for_coroutine():
|
||||
"""Testing skip unwinding stack on yield for coroutines for "next" command
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue