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

Method test_custom_failure_repr

testing/test_runner.py:224–247  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

222 # assert rep.longrepr.reprtraceback.reprentries
223
224 def test_custom_failure_repr(self, pytester: Pytester) -> None:
225 pytester.makepyfile(
226 conftest="""
227 import pytest
228 class Function(pytest.Function):
229 def repr_failure(self, excinfo):
230 return "hello"
231 """
232 )
233 reports = pytester.runitem(
234 """
235 import pytest
236 def test_func():
237 assert 0
238 """
239 )
240 rep = reports[1]
241 assert not rep.skipped
242 assert not rep.passed
243 assert rep.failed
244 # assert rep.outcome.when == "call"
245 # assert rep.failed.where.lineno == 3
246 # assert rep.failed.where.path.basename == "test_func.py"
247 # assert rep.failed.failurerepr == "hello"
248
249 def test_teardown_final_returncode(self, pytester: Pytester) -> None:
250 rec = pytester.inline_runsource(

Callers

nothing calls this directly

Calls 2

makepyfileMethod · 0.45
runitemMethod · 0.45

Tested by

no test coverage detected