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

Function pytest_pyfunc_call

src/_pytest/python.py:161–178  ·  view source on GitHub ↗
(pyfuncitem: Function)

Source from the content-addressed store, hash-verified

159
160@hookimpl(trylast=True)
161def pytest_pyfunc_call(pyfuncitem: Function) -> object | None:
162 testfunction = pyfuncitem.obj
163 if is_async_function(testfunction):
164 async_fail(pyfuncitem.nodeid)
165 funcargs = pyfuncitem.funcargs
166 testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames}
167 result = testfunction(**testargs)
168 if hasattr(result, "__await__") or hasattr(result, "__aiter__"):
169 async_fail(pyfuncitem.nodeid)
170 elif result is not None:
171 warnings.warn(
172 PytestReturnNotNoneWarning(
173 f"Test functions should return None, but {pyfuncitem.nodeid} returned {type(result)!r}.\n"
174 "Did you mean to use `assert` instead of `return`?\n"
175 "See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information."
176 )
177 )
178 return True
179
180
181def pytest_collect_directory(

Callers

nothing calls this directly

Calls 4

is_async_functionFunction · 0.90
async_failFunction · 0.85
warnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…