Skip to content

Commit 40718ef

Browse files
committed
Fix/revisit do_continue with regard to conditions
1 parent d406786 commit 40718ef

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/_pytest/debugging.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,25 @@ def do_debug(self, arg):
146146

147147
def do_continue(self, arg):
148148
ret = super(_PdbWrapper, self).do_continue(arg)
149-
if self._pytest_capman:
149+
if cls._recursive_debug == 0:
150150
tw = _pytest.config.create_terminal_writer(cls._config)
151151
tw.line()
152-
if cls._recursive_debug == 0:
152+
if self._pytest_capman:
153153
capturing = self._pytest_capman.is_capturing()
154+
else:
155+
capturing = False
156+
if capturing:
154157
if capturing == "global":
155158
tw.sep(">", "PDB continue (IO-capturing resumed)")
156-
elif capturing:
159+
else:
157160
tw.sep(
158161
">",
159162
"PDB continue (IO-capturing resumed for %s)"
160163
% capturing,
161164
)
162-
else:
163-
tw.sep(">", "PDB continue")
164165
self._pytest_capman.resume()
166+
else:
167+
tw.sep(">", "PDB continue")
165168
cls._pluginmanager.hook.pytest_leave_pdb(
166169
config=cls._config, pdb=self
167170
)

testing/test_pdb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ def test_1():
576576
child.sendline("c")
577577
child.expect("LEAVING RECURSIVE DEBUGGER")
578578
assert b"PDB continue" not in child.before
579-
assert b"print_from_foo" in child.before
579+
# No extra newline.
580+
assert child.before.endswith(b"c\r\nprint_from_foo\r\n")
580581
child.sendline("c")
581582
child.expect(r"PDB continue \(IO-capturing resumed\)")
582583
rest = child.read().decode("utf8")

0 commit comments

Comments
 (0)