MCPcopy
hub / github.com/pytest-dev/pytest / _enter_pdb

Function _enter_pdb

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 6

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

Tested by

no test coverage detected