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

Function pytest_fixture_setup

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

_show_fixture_actionFunction · 0.85
idsMethod · 0.80

Tested by

no test coverage detected