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

Function _show_fixture_action

src/_pytest/setuponly.py:64–91  ·  view source on GitHub ↗
(
    fixturedef: FixtureDef[object], config: Config, msg: str
)

Source from the content-addressed store, hash-verified

62
63
64def _show_fixture_action(
65 fixturedef: FixtureDef[object], config: Config, msg: str
66) -> None:
67 capman = config.pluginmanager.getplugin("capturemanager")
68 if capman:
69 capman.suspend_global_capture()
70
71 tw = config.get_terminal_writer()
72 tw.line()
73 # Use smaller indentation the higher the scope: Session = 0, Package = 1, etc.
74 scope_indent = list(reversed(Scope)).index(fixturedef._scope)
75 tw.write(" " * 2 * scope_indent)
76
77 scopename = fixturedef.scope[0].upper()
78 tw.write(f"{msg:<8} {scopename} {fixturedef.argname}")
79
80 if msg == "SETUP":
81 deps = sorted(arg for arg in fixturedef.argnames if arg != "request")
82 if deps:
83 tw.write(" (fixtures used: {})".format(", ".join(deps)))
84
85 if hasattr(fixturedef, "cached_param"):
86 tw.write(f"[{saferepr(fixturedef.cached_param, maxsize=42)}]")
87
88 tw.flush()
89
90 if capman:
91 capman.resume_global_capture()
92
93
94@pytest.hookimpl(tryfirst=True)

Callers 2

pytest_fixture_setupFunction · 0.85

Calls 10

safereprFunction · 0.90
getpluginMethod · 0.80
joinMethod · 0.80
resume_global_captureMethod · 0.80
get_terminal_writerMethod · 0.45
lineMethod · 0.45
writeMethod · 0.45
formatMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected