diff --git a/_pytest/debugging.py b/_pytest/debugging.py index aa9c9a3863f..73817ec068c 100644 --- a/_pytest/debugging.py +++ b/_pytest/debugging.py @@ -59,7 +59,23 @@ def set_trace(cls): tw.line() tw.sep(">", "PDB set_trace (IO-capturing turned off)") cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config) - cls._pdb_cls().set_trace(frame) + + class PytestPdb(cls._pdb_cls): + def do_continue(self, arg): + ret = super(PytestPdb, self).do_continue(arg) + if self._pytest_capman: + tw = _pytest.config.create_terminal_writer(cls._config) + tw.line() + tw.sep(">", "PDB continue (IO-capturing resumed)") + self._pytest_capman.resumecapture() + return ret + do_c = do_cont = do_continue + + _pdb = PytestPdb() + _pdb._pytest_capman = capman + else: + _pdb = cls._pdb_cls() + _pdb.set_trace(frame) class PdbInvoke: