summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2018-01-29 01:31:00 (GMT)
committerYury Selivanov <yury@magic.io>2018-01-29 01:31:00 (GMT)
commitc7ab581db216aeeb1c2aa7af2f2198d2b7516383 (patch)
tree2f02081f2cfe0c9d9ec1741521d93605e7715374 /Lib/test/test_pdb.py
parent46877024423e98d1b872bf308dacacd583327207 (diff)
downloadcpython-c7ab581db216aeeb1c2aa7af2f2198d2b7516383.zip
cpython-c7ab581db216aeeb1c2aa7af2f2198d2b7516383.tar.gz
cpython-c7ab581db216aeeb1c2aa7af2f2198d2b7516383.tar.bz2
bpo-32650 Add support for async generators and more test for coroutines in pdb (#5403)
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py43
1 files changed, 42 insertions, 1 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 9ee1d9d..47a669f 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -742,7 +742,7 @@ def test_pdb_next_command_for_coroutine():
... await test_coro()
>>> def test_function():
- ... loop = asyncio.get_event_loop()
+ ... loop = asyncio.new_event_loop()
... loop.run_until_complete(test_main())
... loop.close()
... print("finished")
@@ -837,6 +837,47 @@ def test_pdb_return_command_for_generator():
finished
"""
+def test_pdb_return_command_for_coroutine():
+ """Testing no unwindng stack on yield for coroutines for "return" 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.new_event_loop()
+ ... loop.run_until_complete(test_main())
+ ... loop.close()
+ ... print("finished")
+
+ >>> with PdbTestInput(['step',
+ ... 'step',
+ ... 'next',
+ ... 'continue']):
+ ... test_function()
+ > <doctest test.test_pdb.test_pdb_return_command_for_coroutine[2]>(3)test_main()
+ -> await test_coro()
+ (Pdb) step
+ --Call--
+ > <doctest test.test_pdb.test_pdb_return_command_for_coroutine[1]>(1)test_coro()
+ -> async def test_coro():
+ (Pdb) step
+ > <doctest test.test_pdb.test_pdb_return_command_for_coroutine[1]>(2)test_coro()
+ -> await asyncio.sleep(0)
+ (Pdb) next
+ > <doctest test.test_pdb.test_pdb_return_command_for_coroutine[1]>(3)test_coro()
+ -> await asyncio.sleep(0)
+ (Pdb) continue
+ finished
+ """
+
def test_pdb_until_command_for_generator():
"""Testing no unwindng stack on yield for generators
for "until" command if target breakpoing is not reached