@classmethod<EOL><INDENT>def _init_pdb(cls, *args, **kwargs):<DEDENT>
import _pytest.config<EOL>if cls._pluginmanager is not None:<EOL><INDENT>capman = cls._pluginmanager.getplugin("<STR_LIT>")<EOL>if capman:<EOL><INDENT>capman.suspend(in_=True)<EOL><DEDENT>tw = _pytest.config.create_terminal_writer(cls._config)<EOL>tw.line()<EOL>if cls._recursive_debug == <NUM_LIT:0>:<EOL><INDENT>header = kwargs.pop("<STR_LIT>", None)<EOL>if header is not None:<EOL><INDENT>tw.sep("<STR_LIT:>>", header)<EOL><DEDENT>else:<EOL><INDENT>capturing = cls._is_capturing(capman)<EOL>if capturing:<EOL><INDENT>if capturing == "<STR_LIT>":<EOL><INDENT>tw.sep("<STR_LIT:>>", "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>tw.sep(<EOL>"<STR_LIT:>>",<EOL>"<STR_LIT>"<EOL>% capturing,<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>tw.sep("<STR_LIT:>>", "<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>class _PdbWrapper(cls._pdb_cls, object):<EOL><INDENT>_pytest_capman = capman<EOL>_continued = False<EOL>def do_debug(self, arg):<EOL><INDENT>cls._recursive_debug += <NUM_LIT:1><EOL>ret = super(_PdbWrapper, self).do_debug(arg)<EOL>cls._recursive_debug -= <NUM_LIT:1><EOL>return ret<EOL><DEDENT>def do_continue(self, arg):<EOL><INDENT>ret = super(_PdbWrapper, self).do_continue(arg)<EOL>if cls._recursive_debug == <NUM_LIT:0>:<EOL><INDENT>tw = _pytest.config.create_terminal_writer(cls._config)<EOL>tw.line()<EOL>capman = self._pytest_capman<EOL>capturing = pytestPDB._is_capturing(capman)<EOL>if capturing:<EOL><INDENT>if capturing == "<STR_LIT>":<EOL><INDENT>tw.sep("<STR_LIT:>>", "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>tw.sep(<EOL>"<STR_LIT:>>",<EOL>"<STR_LIT>"<EOL>% capturing,<EOL>)<EOL><DEDENT>capman.resume()<EOL><DEDENT>else:<EOL><INDENT>tw.sep("<STR_LIT:>>", "<STR_LIT>")<EOL><DEDENT><DEDENT>cls._pluginmanager.hook.pytest_leave_pdb(<EOL>config=cls._config, pdb=self<EOL>)<EOL>self._continued = True<EOL>return ret<EOL><DEDENT>do_c = do_cont = do_continue<EOL>def set_quit(self):<EOL><INDENT>"""<STR_LIT>"""<EOL>super(_PdbWrapper, self).set_quit()<EOL>if cls._recursive_debug == <NUM_LIT:0>:<EOL><INDENT>outcomes.exit("<STR_LIT>")<EOL><DEDENT><DEDENT>def setup(self, f, tb):<EOL><INDENT>"""<STR_LIT>"""<EOL>ret = super(_PdbWrapper, self).setup(f, tb)<EOL>if not ret and self._continued:<EOL><INDENT>if self._pytest_capman:<EOL><INDENT>self._pytest_capman.suspend_global_capture(in_=True)<EOL><DEDENT><DEDENT>return ret<EOL><DEDENT><DEDENT>_pdb = _PdbWrapper(**kwargs)<EOL>cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config, pdb=_pdb)<EOL><DEDENT>else:<EOL><INDENT>_pdb = cls._pdb_cls(**kwargs)<EOL><DEDENT>return _pdb<EOL>
Initialize PDB debugging, dropping any IO capturing.