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

Function pytest_runtest_makereport

src/_pytest/unittest.py:334–357  ·  view source on GitHub ↗
(item: Item, call: CallInfo[None])

Source from the content-addressed store, hash-verified

332
333@hookimpl(tryfirst=True)
334def pytest_runtest_makereport(item: Item, call: CallInfo[None]) -> None:
335 if isinstance(item, TestCaseFunction):
336 if item._excinfo:
337 call.excinfo = item._excinfo.pop(0)
338 try:
339 del call.result
340 except AttributeError:
341 pass
342
343 # Convert unittest.SkipTest to pytest.skip.
344 # This is actually only needed for nose, which reuses unittest.SkipTest for
345 # its own nose.SkipTest. For unittest TestCases, SkipTest is already
346 # handled internally, and doesn't reach here.
347 unittest = sys.modules.get("unittest")
348 if (
349 unittest
350 and call.excinfo
351 and isinstance(call.excinfo.value, unittest.SkipTest) # type: ignore[attr-defined]
352 ):
353 excinfo = call.excinfo
354 call2 = CallInfo[None].from_call(
355 lambda: pytest.skip(str(excinfo.value)), call.when
356 )
357 call.excinfo = call2.excinfo
358
359
360# Twisted trial support.

Callers

nothing calls this directly

Calls 3

popMethod · 0.80
from_callMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected