Fix/revisit do_continue with regard to conditions

This commit is contained in:
Daniel Hahler 2019-03-19 00:47:22 +01:00
parent d406786a8d
commit 40718efacc
2 changed files with 10 additions and 6 deletions

View File

@ -146,22 +146,25 @@ class pytestPDB(object):
def do_continue(self, arg): def do_continue(self, arg):
ret = super(_PdbWrapper, self).do_continue(arg) ret = super(_PdbWrapper, self).do_continue(arg)
if self._pytest_capman: if cls._recursive_debug == 0:
tw = _pytest.config.create_terminal_writer(cls._config) tw = _pytest.config.create_terminal_writer(cls._config)
tw.line() tw.line()
if cls._recursive_debug == 0: if self._pytest_capman:
capturing = self._pytest_capman.is_capturing() capturing = self._pytest_capman.is_capturing()
else:
capturing = False
if capturing:
if capturing == "global": if capturing == "global":
tw.sep(">", "PDB continue (IO-capturing resumed)") tw.sep(">", "PDB continue (IO-capturing resumed)")
elif capturing: else:
tw.sep( tw.sep(
">", ">",
"PDB continue (IO-capturing resumed for %s)" "PDB continue (IO-capturing resumed for %s)"
% capturing, % capturing,
) )
else:
tw.sep(">", "PDB continue")
self._pytest_capman.resume() self._pytest_capman.resume()
else:
tw.sep(">", "PDB continue")
cls._pluginmanager.hook.pytest_leave_pdb( cls._pluginmanager.hook.pytest_leave_pdb(
config=cls._config, pdb=self config=cls._config, pdb=self
) )

View File

@ -576,7 +576,8 @@ class TestPDB(object):
child.sendline("c") child.sendline("c")
child.expect("LEAVING RECURSIVE DEBUGGER") child.expect("LEAVING RECURSIVE DEBUGGER")
assert b"PDB continue" not in child.before assert b"PDB continue" not in child.before
assert b"print_from_foo" in child.before # No extra newline.
assert child.before.endswith(b"c\r\nprint_from_foo\r\n")
child.sendline("c") child.sendline("c")
child.expect(r"PDB continue \(IO-capturing resumed\)") child.expect(r"PDB continue \(IO-capturing resumed\)")
rest = child.read().decode("utf8") rest = child.read().decode("utf8")