diff options
author | Daniel Hahler <git@thequod.de> | 2019-03-18 22:58:22 +0100 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-03-28 11:49:01 +0100 |
commit | d406786a8d935cddd9c8b1388535200205527c20 (patch) | |
tree | db4dc8cd8d8451b33ed5df656af751df55d7fe8a /src/_pytest/debugging.py | |
parent | c92021fc4f7cec38a973a12e3d1a32a8686384fb (diff) | |
download | pytest-d406786a8d935cddd9c8b1388535200205527c20.tar.gz |
pdb: handle capturing with fixtures only
Diffstat (limited to 'src/_pytest/debugging.py')
-rw-r--r-- | src/_pytest/debugging.py | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py index 5b780d101..abe4f65b6 100644 --- a/src/_pytest/debugging.py +++ b/src/_pytest/debugging.py @@ -109,7 +109,7 @@ class pytestPDB(object): if cls._pluginmanager is not None: capman = cls._pluginmanager.getplugin("capturemanager") if capman: - capman.suspend_global_capture(in_=True) + capman.suspend(in_=True) tw = _pytest.config.create_terminal_writer(cls._config) tw.line() if cls._recursive_debug == 0: @@ -117,10 +117,22 @@ class pytestPDB(object): header = kwargs.pop("header", None) if header is not None: tw.sep(">", header) - elif capman and capman.is_globally_capturing(): - tw.sep(">", "PDB set_trace (IO-capturing turned off)") else: - tw.sep(">", "PDB set_trace") + if capman: + capturing = capman.is_capturing() + else: + capturing = False + if capturing: + if capturing == "global": + tw.sep(">", "PDB set_trace (IO-capturing turned off)") + else: + tw.sep( + ">", + "PDB set_trace (IO-capturing turned off for %s)" + % capturing, + ) + else: + tw.sep(">", "PDB set_trace") class _PdbWrapper(cls._pdb_cls, object): _pytest_capman = capman @@ -138,11 +150,18 @@ class pytestPDB(object): tw = _pytest.config.create_terminal_writer(cls._config) tw.line() if cls._recursive_debug == 0: - if self._pytest_capman.is_globally_capturing(): + capturing = self._pytest_capman.is_capturing() + if capturing == "global": tw.sep(">", "PDB continue (IO-capturing resumed)") + elif capturing: + tw.sep( + ">", + "PDB continue (IO-capturing resumed for %s)" + % capturing, + ) else: tw.sep(">", "PDB continue") - self._pytest_capman.resume_global_capture() + self._pytest_capman.resume() cls._pluginmanager.hook.pytest_leave_pdb( config=cls._config, pdb=self ) |