summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2018-01-29 00:25:05 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2018-01-29 00:25:05 (GMT)
commit46877024423e98d1b872bf308dacacd583327207 (patch)
tree4102fda9ce2633eee0ac491dff9e1a99a86f0908 /Lib/test/test_pdb.py
parent7c99e931a90d468e8019a0409f16213b3aba7067 (diff)
downloadcpython-46877024423e98d1b872bf308dacacd583327207.zip
cpython-46877024423e98d1b872bf308dacacd583327207.tar.gz
cpython-46877024423e98d1b872bf308dacacd583327207.tar.bz2
bpo-32650: Add native coroutine support to bdb when stepping over line (GH-5400)
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 85b47d5..9ee1d9d 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -727,6 +727,61 @@ def test_pdb_next_command_for_generator():
finished
"""
+def test_pdb_next_command_for_coroutine():
+ """Testing skip unwindng stack on yield for coroutines for "next" command
+
+ >>> import asyncio
+
+ >>> async def test_coro():
+ ... await asyncio.sleep(0)
+ ... await asyncio.sleep(0)
+ ... await asyncio.sleep(0)
+
+ >>> async def test_main():
+ ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
+ ... await test_coro()
+
+ >>> def test_function():
+ ... loop = asyncio.get_event_loop()
+ ... loop.run_until_complete(test_main())
+ ... loop.close()
+ ... print("finished")
+
+ >>> with PdbTestInput(['step',
+ ... 'step',
+ ... 'next',
+ ... 'next',
+ ... 'next',
+ ... 'step',
+ ... 'continue']):
+ ... test_function()
+ > <doctest test.test_pdb.test_pdb_next_command_for_coroutine[2]>(3)test_main()
+ -> await test_coro()
+ (Pdb) step
+ --Call--
+ > <doctest test.test_pdb.test_pdb_next_command_for_coroutine[1]>(1)test_coro()
+ -> async def test_coro():
+ (Pdb) step
+ > <doctest test.test_pdb.test_pdb_next_command_for_coroutine[1]>(2)test_coro()
+ -> await asyncio.sleep(0)
+ (Pdb) next
+ > <doctest test.test_pdb.test_pdb_next_command_for_coroutine[1]>(3)test_coro()
+ -> await asyncio.sleep(0)
+ (Pdb) next
+ > <doctest test.test_pdb.test_pdb_next_command_for_coroutine[1]>(4)test_coro()
+ -> await asyncio.sleep(0)
+ (Pdb) next
+ Internal StopIteration
+ > <doctest test.test_pdb.test_pdb_next_command_for_coroutine[2]>(3)test_main()
+ -> await test_coro()
+ (Pdb) step
+ --Return--
+ > <doctest test.test_pdb.test_pdb_next_command_for_coroutine[2]>(3)test_main()->None
+ -> await test_coro()
+ (Pdb) continue
+ finished
+ """
+
def test_pdb_return_command_for_generator():
"""Testing no unwindng stack on yield for generators
for "return" command