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

Class ReprTraceback

src/_pytest/_code/code.py:1335–1359  ·  view source on GitHub ↗

A traceback with optional extra details (function arguments, function locals, file location) and possible extra line emitted at the end.

Source from the content-addressed store, hash-verified

1333
1334@dataclasses.dataclass(eq=False)
1335class ReprTraceback(TerminalRepr):
1336 """A traceback with optional extra details (function arguments, function
1337 locals, file location) and possible extra line emitted at the end."""
1338
1339 reprentries: Sequence[ReprEntry | ReprEntryNative]
1340 extraline: str | None
1341 style: TracebackStyle
1342
1343 entrysep: ClassVar = "_ "
1344
1345 def toterminal(self, tw: TerminalWriter) -> None:
1346 # The entries might have different styles.
1347 for i, entry in enumerate(self.reprentries):
1348 if entry.style == "long":
1349 tw.line("")
1350 entry.toterminal(tw)
1351 if i < len(self.reprentries) - 1:
1352 next_entry = self.reprentries[i + 1]
1353 if entry.style == "long" or (
1354 entry.style == "short" and next_entry.style == "long"
1355 ):
1356 tw.sep(self.entrysep)
1357
1358 if self.extraline:
1359 tw.line(self.extraline)
1360
1361
1362class ReprTracebackNative(ReprTraceback):

Callers 2

repr_tracebackMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected