MCPcopy Create free account
hub / github.com/pytest-dev/pytest / _enter_pdb

Function _enter_pdb

src/_pytest/debugging.py:336–364  ·  view source on GitHub ↗
(
    node: Node, excinfo: ExceptionInfo[BaseException], rep: BaseReport
)

Source from the content-addressed store, hash-verified

334
335
336def _enter_pdb(
337 node: Node, excinfo: ExceptionInfo[BaseException], rep: BaseReport
338) -> BaseReport:
339 # XXX we re-use the TerminalReporter's terminalwriter
340 # because this seems to avoid some encoding related troubles
341 # for not completely clear reasons.
342 tw = node.config.pluginmanager.getplugin("terminalreporter")._tw
343 tw.line()
344
345 showcapture = node.config.option.showcapture
346
347 for sectionname, content in (
348 ("stdout", rep.capstdout),
349 ("stderr", rep.capstderr),
350 ("log", rep.caplog),
351 ):
352 if showcapture in (sectionname, "all") and content:
353 tw.sep(">", "captured " + sectionname)
354 if content[-1:] == "\n":
355 content = content[:-1]
356 tw.line(content)
357
358 tw.sep(">", "traceback")
359 rep.toterminal(tw)
360 tw.sep(">", "entering PDB")
361 tb = _postmortem_traceback(excinfo)
362 rep._pdbshown = True # type: ignore[attr-defined]
363 post_mortem(tb)
364 return rep
365
366
367def _postmortem_traceback(excinfo: ExceptionInfo[BaseException]) -> types.TracebackType:

Callers 1

Calls 6

_postmortem_tracebackFunction · 0.85
post_mortemFunction · 0.85
getpluginMethod · 0.80
lineMethod · 0.45
sepMethod · 0.45
toterminalMethod · 0.45

Tested by

no test coverage detected