Esempio n. 1
0
def _enter_pdb(node: Node, excinfo: ExceptionInfo[BaseException],
               rep: BaseReport) -> BaseReport:
    # XXX we re-use the TerminalReporter's terminalwriter
    # because this seems to avoid some encoding related troubles
    # for not completely clear reasons.
    tw = node.config.pluginmanager.getplugin("terminalreporter")._tw
    tw.line()

    showcapture = node.config.option.showcapture

    for sectionname, content in (
        ("stdout", rep.capstdout),
        ("stderr", rep.capstderr),
        ("log", rep.caplog),
    ):
        if showcapture in (sectionname, "all") and content:
            tw.sep(">", "captured " + sectionname)
            if content[-1:] == "\n":
                content = content[:-1]
            tw.line(content)

    tw.sep(">", "traceback")
    rep.toterminal(tw)
    tw.sep(">", "entering PDB")
    tb = _postmortem_traceback(excinfo)
    rep._pdbshown = True  # type: ignore[attr-defined]
    post_mortem(tb)
    return rep
Esempio n. 2
0
 def _outrep_summary(self, rep: BaseReport) -> None:
     rep.toterminal(self._tw)
     showcapture = self.config.option.showcapture
     if showcapture == "no":
         return
     for secname, content in rep.sections:
         if showcapture != "all" and showcapture not in secname:
             continue
         self._tw.sep("-", secname)
         if content[-1:] == "\n":
             content = content[:-1]
         self._tw.line(content)