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

Function pytest_runtest_makereport

src/_pytest/skipping.py:277–312  ·  view source on GitHub ↗
(
    item: Item, call: CallInfo[None]
)

Source from the content-addressed store, hash-verified

275
276@hookimpl(wrapper=True)
277def pytest_runtest_makereport(
278 item: Item, call: CallInfo[None]
279) -> Generator[None, TestReport, TestReport]:
280 rep = yield
281 xfailed = item.stash.get(xfailed_key, None)
282 if item.config.option.runxfail:
283 pass # don't interfere
284 elif call.excinfo and isinstance(call.excinfo.value, xfail.Exception):
285 assert call.excinfo.value.msg is not None
286 rep.wasxfail = call.excinfo.value.msg
287 rep.outcome = "skipped"
288 elif not rep.skipped and xfailed:
289 if call.excinfo:
290 raises = xfailed.raises
291 if raises is None or (
292 (
293 isinstance(raises, type | tuple)
294 and isinstance(call.excinfo.value, raises)
295 )
296 or (
297 isinstance(raises, AbstractRaises)
298 and raises.matches(call.excinfo.value)
299 )
300 ):
301 rep.outcome = "skipped"
302 rep.wasxfail = xfailed.reason
303 else:
304 rep.outcome = "failed"
305 elif call.when == "call":
306 if xfailed.strict:
307 rep.outcome = "failed"
308 rep.longrepr = "[XPASS(strict)] " + xfailed.reason
309 else:
310 rep.outcome = "passed"
311 rep.wasxfail = xfailed.reason
312 return rep
313
314
315def pytest_report_teststatus(report: BaseReport) -> tuple[str, str, str] | None:

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
matchesMethod · 0.45

Tested by

no test coverage detected