classification
Title: Failed separate test_pdb_next_command_in_generator_for_loop in test_pdb
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.10
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Pdb sometimes raises exception when trying to remove a breakpoint defined in a different debugger session
View: 24160
Assigned To: Nosy List: iritkatriel, serhiy.storchaka, taleinat, xdegaye, xtreak
Priority: normal Keywords: patch

Created on 2018-06-03 15:43 by serhiy.storchaka, last changed 2021-04-02 16:22 by iritkatriel. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7563 closed xdegaye, 2018-06-09 16:25
Messages (3)
msg318560 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-06-03 15:43
$ ./python -m test -v -m test_pdb_next_command_in_generator_for_loop test_pdb
...
test_pdb_next_command_in_generator_for_loop (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_in_generator_for_loop ... FAIL

======================================================================
FAIL: test_pdb_next_command_in_generator_for_loop (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_in_generator_for_loop
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-tmp2/Lib/doctest.py", line 2193, in runTest
    test, out=new.write, clear_globs=False)
AssertionError: Failed doctest test for test.test_pdb.test_pdb_next_command_in_generator_for_loop
  File "/home/serhiy/py/cpython-tmp2/Lib/test/test_pdb.py", line 1035, in test_pdb_next_command_in_generator_for_loop

----------------------------------------------------------------------
File "/home/serhiy/py/cpython-tmp2/Lib/test/test_pdb.py", line 1048, in test.test_pdb.test_pdb_next_command_in_generator_for_loop
Failed example:
    with PdbTestInput(['break test_gen',
                       'continue',
                       'next',
                       'next',
                       'next',
                       'continue']):
        test_function()
Expected:
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
    -> for i in test_gen():
    (Pdb) break test_gen
    Breakpoint 6 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
    (Pdb) continue
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(2)test_gen()
    -> yield 0
    (Pdb) next
    value 0
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(3)test_gen()
    -> return 1
    (Pdb) next
    Internal StopIteration: 1
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
    -> for i in test_gen():
    (Pdb) next
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(5)test_function()
    -> x = 123
    (Pdb) continue
Got:
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
    -> for i in test_gen():
    (Pdb) break test_gen
    Breakpoint 1 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
    (Pdb) continue
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(2)test_gen()
    -> yield 0
    (Pdb) next
    value 0
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(3)test_gen()
    -> return 1
    (Pdb) next
    Internal StopIteration: 1
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
    -> for i in test_gen():
    (Pdb) next
    > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(5)test_function()
    -> x = 123
    (Pdb) continue


----------------------------------------------------------------------
msg319144 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2018-06-09 12:06
This is fixed with:

diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 4f9d28afd3..7b3624fb99 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1045,7 +1045,7 @@ def test_pdb_next_command_in_generator_for_loop():
     ...         print('value', i)
     ...     x = 123
 
-    >>> with PdbTestInput(['break test_gen',
+    >>> with PdbTestInput(['break test_gen', # doctest: +ELLIPSIS
     ...                    'continue',
     ...                    'next',
     ...                    'next',
@@ -1055,7 +1055,7 @@ def test_pdb_next_command_in_generator_for_loop():
     > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
     -> for i in test_gen():
     (Pdb) break test_gen
-    Breakpoint 6 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
+    Breakpoint ... at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
     (Pdb) continue
     > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(2)test_gen()
     -> yield 0

I will submit a PR shortly.
msg385068 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-01-14 12:45
This will be resolved once we push PR 21989, which resets the breakpoints before the test so the breakpoint number here is always 1.
History
Date User Action Args
2021-04-02 16:22:47iritkatrielsetsuperseder: Missing (optional) argument `start` and `end` in documentation for list.index -> Pdb sometimes raises exception when trying to remove a breakpoint defined in a different debugger session
2021-04-02 16:21:00iritkatrielsetstatus: open -> closed
superseder: Missing (optional) argument `start` and `end` in documentation for list.index
resolution: duplicate
stage: patch review -> resolved
2021-01-14 12:45:05iritkatrielsetnosy: + iritkatriel, taleinat

messages: + msg385068
versions: + Python 3.10, - Python 3.6, Python 3.7, Python 3.8
2018-11-04 04:49:27xtreaksetnosy: + xtreak
2018-06-09 16:25:31xdegayesetkeywords: + patch
stage: patch review
pull_requests: + pull_request7195
2018-06-09 12:06:29xdegayesetnosy: + xdegaye
messages: + msg319144
2018-06-03 15:43:25serhiy.storchakacreate