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

Class ReprFileLocation

src/_pytest/_code/code.py:1483–1503  ·  view source on GitHub ↗

A message at a file location, using the `<path>:<lineno>: <message>` format that most editors understand. Only the first line of the message is emitted.

Source from the content-addressed store, hash-verified

1481
1482@dataclasses.dataclass(eq=False)
1483class ReprFileLocation(TerminalRepr):
1484 """A message at a file location, using the `<path>:<lineno>: <message>`
1485 format that most editors understand.
1486
1487 Only the first line of the message is emitted.
1488 """
1489
1490 path: str
1491 lineno: int
1492 message: str
1493
1494 def __post_init__(self) -> None:
1495 self.path = str(self.path)
1496
1497 def toterminal(self, tw: TerminalWriter) -> None:
1498 msg = self.message
1499 i = msg.find("\n")
1500 if i != -1:
1501 msg = msg[:i]
1502 tw.write(self.path, bold=True, red=True)
1503 tw.line(f":{self.lineno}: {msg}")
1504
1505
1506@dataclasses.dataclass(eq=False)

Callers 5

repr_failureMethod · 0.90
deserialize_repr_entryFunction · 0.90
deserialize_repr_crashFunction · 0.90
_getreprcrashMethod · 0.85
repr_traceback_entryMethod · 0.85

Calls

no outgoing calls

Tested by 1

repr_failureMethod · 0.72