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

Method test_format_excinfo

testing/code/test_excinfo.py:1065–1080  ·  view source on GitHub ↗
(self, reproptions: Dict[str, Any])

Source from the content-addressed store, hash-verified

1063 ],
1064 )
1065 def test_format_excinfo(self, reproptions: Dict[str, Any]) -> None:
1066 def bar():
1067 assert False, "some error"
1068
1069 def foo():
1070 bar()
1071
1072 # using inline functions as opposed to importasmod so we get source code lines
1073 # in the tracebacks (otherwise getinspect doesn't find the source code).
1074 with pytest.raises(AssertionError) as excinfo:
1075 foo()
1076 file = io.StringIO()
1077 tw = TerminalWriter(file=file)
1078 repr = excinfo.getrepr(**reproptions)
1079 repr.toterminal(tw)
1080 assert file.getvalue()
1081
1082 def test_traceback_repr_style(self, importasmod, tw_mock):
1083 mod = importasmod(

Callers

nothing calls this directly

Calls 5

TerminalWriterClass · 0.90
getreprMethod · 0.80
fooFunction · 0.50
toterminalMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected