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

Method test_custom_failure_repr

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

Source from the content-addressed store, hash-verified

286 # assert rep.longrepr.reprtraceback.reprentries
287
288 def test_custom_failure_repr(self, pytester: Pytester) -> None:
289 pytester.makepyfile(
290 conftest="""
291 import pytest
292 class Function(pytest.Function):
293 def repr_failure(self, excinfo):
294 return "hello"
295 """
296 )
297 reports = pytester.runitem(
298 """
299 import pytest
300 def test_func():
301 assert 0
302 """
303 )
304 rep = reports[1]
305 assert not rep.skipped
306 assert not rep.passed
307 assert rep.failed
308 # assert rep.outcome.when == "call"
309 # assert rep.failed.where.lineno == 3
310 # assert rep.failed.where.path.basename == "test_func.py"
311 # assert rep.failed.failurerepr == "hello"
312
313 def test_teardown_final_returncode(self, pytester: Pytester) -> None:
314 rec = pytester.inline_runsource(

Callers

nothing calls this directly

Calls 2

makepyfileMethod · 0.45
runitemMethod · 0.45

Tested by

no test coverage detected