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

Function pytest_fixture_setup

src/_pytest/setuponly.py:32–50  ·  view source on GitHub ↗
(
    fixturedef: FixtureDef[object], request: SubRequest
)

Source from the content-addressed store, hash-verified

30
31@pytest.hookimpl(wrapper=True)
32def pytest_fixture_setup(
33 fixturedef: FixtureDef[object], request: SubRequest
34) -> Generator[None, object, object]:
35 try:
36 return (yield)
37 finally:
38 if request.config.option.setupshow:
39 if hasattr(request, "param"):
40 # Save the fixture parameter so ._show_fixture_action() can
41 # display it now and during the teardown (in .finish()).
42 if fixturedef.ids:
43 if callable(fixturedef.ids):
44 param = fixturedef.ids(request.param)
45 else:
46 param = fixturedef.ids[request.param_index]
47 else:
48 param = request.param
49 fixturedef.cached_param = param # type: ignore[attr-defined]
50 _show_fixture_action(fixturedef, request.config, "SETUP")
51
52
53def pytest_fixture_post_finalizer(

Callers

nothing calls this directly

Calls 2

_show_fixture_actionFunction · 0.85
idsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…