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

Function call_runtest_hook

src/_pytest/runner.py:246–262  ·  view source on GitHub ↗
(
    item: Item, when: "Literal['setup', 'call', 'teardown']", **kwds
)

Source from the content-addressed store, hash-verified

244
245
246def call_runtest_hook(
247 item: Item, when: "Literal['setup', 'call', 'teardown']", **kwds
248) -> "CallInfo[None]":
249 if when == "setup":
250 ihook: Callable[..., None] = item.ihook.pytest_runtest_setup
251 elif when == "call":
252 ihook = item.ihook.pytest_runtest_call
253 elif when == "teardown":
254 ihook = item.ihook.pytest_runtest_teardown
255 else:
256 assert False, f"Unhandled runtest hook case: {when}"
257 reraise: Tuple[Type[BaseException], ...] = (Exit,)
258 if not item.config.getoption("usepdb", False):
259 reraise += (KeyboardInterrupt,)
260 return CallInfo.from_call(
261 lambda: ihook(item=item, **kwds), when=when, reraise=reraise
262 )
263
264
265TResult = TypeVar("TResult", covariant=True)

Callers 1

call_and_reportFunction · 0.85

Calls 2

from_callMethod · 0.80
getoptionMethod · 0.45

Tested by

no test coverage detected