pytest_{enter,leave}_pdb: pass through pdb instance
This commit is contained in:
@@ -95,7 +95,6 @@ class pytestPDB(object):
|
||||
tw = _pytest.config.create_terminal_writer(cls._config)
|
||||
tw.line()
|
||||
tw.sep(">", "PDB set_trace (IO-capturing turned off)")
|
||||
cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config)
|
||||
|
||||
class _PdbWrapper(cls._pdb_cls, object):
|
||||
_pytest_capman = capman
|
||||
@@ -108,7 +107,9 @@ class pytestPDB(object):
|
||||
tw.line()
|
||||
tw.sep(">", "PDB continue (IO-capturing resumed)")
|
||||
self._pytest_capman.resume_global_capture()
|
||||
cls._pluginmanager.hook.pytest_leave_pdb(config=cls._config)
|
||||
cls._pluginmanager.hook.pytest_leave_pdb(
|
||||
config=cls._config, pdb=self
|
||||
)
|
||||
self._continued = True
|
||||
return ret
|
||||
|
||||
@@ -129,6 +130,7 @@ class pytestPDB(object):
|
||||
return ret
|
||||
|
||||
_pdb = _PdbWrapper()
|
||||
cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config, pdb=_pdb)
|
||||
else:
|
||||
_pdb = cls._pdb_cls()
|
||||
|
||||
|
||||
@@ -603,19 +603,21 @@ def pytest_exception_interact(node, call, report):
|
||||
"""
|
||||
|
||||
|
||||
def pytest_enter_pdb(config):
|
||||
def pytest_enter_pdb(config, pdb):
|
||||
""" called upon pdb.set_trace(), can be used by plugins to take special
|
||||
action just before the python debugger enters in interactive mode.
|
||||
|
||||
:param _pytest.config.Config config: pytest config object
|
||||
:param pdb.Pdb pdb: Pdb instance
|
||||
"""
|
||||
|
||||
|
||||
def pytest_leave_pdb(config):
|
||||
def pytest_leave_pdb(config, pdb):
|
||||
""" called when leaving pdb (e.g. with continue after pdb.set_trace()).
|
||||
|
||||
Can be used by plugins to take special action just after the python
|
||||
debugger leaves interactive mode.
|
||||
|
||||
:param _pytest.config.Config config: pytest config object
|
||||
:param pdb.Pdb pdb: Pdb instance
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user