From 346add5391bc655876eb06b5da9aa4f77b7ef734 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 27 Mar 2018 13:12:55 +0200 Subject: [PATCH] Add pytest_leave_pdb hook --- src/_pytest/debugging.py | 1 + src/_pytest/hookspec.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py index b72509ff290..4c56302451f 100644 --- a/src/_pytest/debugging.py +++ b/src/_pytest/debugging.py @@ -107,6 +107,7 @@ def do_continue(self, arg): tw.line() tw.sep(">", "PDB continue (IO-capturing resumed)") self._pytest_capman.resume_global_capture() + cls._pluginmanager.hook.pytest_leave_pdb(config=cls._config) return ret do_c = do_cont = do_continue diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index 533806964d5..ae289f0a3d0 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -609,3 +609,13 @@ def pytest_enter_pdb(config): :param _pytest.config.Config config: pytest config object """ + + +def pytest_leave_pdb(config): + """ 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 + """