Skip to content

Commit

Permalink
pdb: resume capturing after continue
Browse files Browse the repository at this point in the history
After `pdb.set_trace()` capturing is turned off.
This patch resumes it after using the `continue` (or `c` / `cont`)
command.
  • Loading branch information
blueyed committed Jul 26, 2017
1 parent 309152d commit ff89643
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion _pytest/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ff89643

Please sign in to comment.