From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 29 Jan 2018 14:56:46 +0000 (-0800) Subject: Add a test for pdb until command in coroutine (GH-5427) (#5428) X-Git-Tag: v3.6.5rc1~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=757aad674808d8d4b717c3bf9994a8f90007798d;p=python Add a test for pdb until command in coroutine (GH-5427) (#5428) (cherry picked from commit 4f4ef0acbad81f4b05f370e8ff14ddf949773291) --- diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 369a0a91e3..f2282c35c8 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -979,6 +979,52 @@ def test_pdb_until_command_for_generator(): finished """ +def test_pdb_until_command_for_coroutine(): + """Testing no unwindng stack for coroutines + for "until" command if target breakpoing is not reached + + >>> import asyncio + + >>> async def test_coro(): + ... print(0) + ... await asyncio.sleep(0) + ... print(1) + ... await asyncio.sleep(0) + ... print(2) + ... await asyncio.sleep(0) + ... print(3) + + >>> async def test_main(): + ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + ... await test_coro() + + >>> def test_function(): + ... loop = asyncio.new_event_loop() + ... loop.run_until_complete(test_main()) + ... loop.close() + ... print("finished") + + >>> with PdbTestInput(['step', + ... 'until 8', + ... 'continue']): + ... test_function() + > (3)test_main() + -> await test_coro() + (Pdb) step + --Call-- + > (1)test_coro() + -> async def test_coro(): + (Pdb) until 8 + 0 + 1 + 2 + > (8)test_coro() + -> print(3) + (Pdb) continue + 3 + finished + """ + def test_pdb_next_command_in_generator_for_loop(): """The next command on returning from a generator controlled by a for loop.