Skip to content

Commit

Permalink
squash! fixup! fixup! pdb: resume capturing after continue
Browse files Browse the repository at this point in the history
Store _pytest_capman on the class, for pdbpp's do_debug hack to keep it.

Without this, `debug …` would fail like this:

    /usr/lib/python3.6/cmd.py:217: in onecmd
        return func(arg)
    .venv/lib/python3.6/site-packages/pdb.py:608: in do_debug
        return orig_do_debug(self, arg)
    /usr/lib/python3.6/pdb.py:1099: in do_debug
        sys.call_tracing(p.run, (arg, globals, locals))
    /usr/lib/python3.6/bdb.py:434: in run
        exec(cmd, globals, locals)
    /usr/lib/python3.6/bdb.py:51: in trace_dispatch
        return self.dispatch_line(frame)
    /usr/lib/python3.6/bdb.py:69: in dispatch_line
        self.user_line(frame)
    /usr/lib/python3.6/pdb.py:261: in user_line
        self.interaction(frame, None)
    .venv/lib/python3.6/site-packages/pdb.py:203: in interaction
        self.setup(frame, traceback)
    E   AttributeError: 'PytestPdb' object has no attribute '_pytest_capman'
  • Loading branch information
blueyed committed Apr 17, 2018
1 parent 4d2916e commit 1771e34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion _pytest/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def set_trace(cls):
cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config)

class PytestPdb(cls._pdb_cls):
_pytest_capman = capman

def do_continue(self, arg):
ret = super(PytestPdb, self).do_continue(arg)
if self._pytest_capman:
Expand All @@ -103,7 +105,6 @@ def setup(self, f, tb):
return ret

_pdb = PytestPdb()
_pdb._pytest_capman = capman
else:
_pdb = cls._pdb_cls()
_pdb.set_trace(frame)
Expand Down

0 comments on commit 1771e34

Please sign in to comment.