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

Class FixtureLookupErrorRepr

src/_pytest/fixtures.py:867–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

865
866
867class FixtureLookupErrorRepr(TerminalRepr):
868 def __init__(
869 self,
870 filename: Union[str, "os.PathLike[str]"],
871 firstlineno: int,
872 tblines: Sequence[str],
873 errorstring: str,
874 argname: Optional[str],
875 ) -> None:
876 self.tblines = tblines
877 self.errorstring = errorstring
878 self.filename = filename
879 self.firstlineno = firstlineno
880 self.argname = argname
881
882 def toterminal(self, tw: TerminalWriter) -> None:
883 # tw.line("FixtureLookupError: %s" %(self.argname), red=True)
884 for tbline in self.tblines:
885 tw.line(tbline.rstrip())
886 lines = self.errorstring.split("\n")
887 if lines:
888 tw.line(
889 f"{FormattedExcinfo.fail_marker} {lines[0].strip()}",
890 red=True,
891 )
892 for line in lines[1:]:
893 tw.line(
894 f"{FormattedExcinfo.flow_marker} {line.strip()}",
895 red=True,
896 )
897 tw.line()
898 tw.line("%s:%d" % (os.fspath(self.filename), self.firstlineno + 1))
899
900
901def fail_fixturefunc(fixturefunc, msg: str) -> "NoReturn":

Callers 1

formatreprMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected