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

Function write_fixture

src/_pytest/fixtures.py:2232–2249  ·  view source on GitHub ↗
(fixture_def: FixtureDef[object])

Source from the content-addressed store, hash-verified

2230 return bestrelpath(invocation_dir, Path(loc))
2231
2232 def write_fixture(fixture_def: FixtureDef[object]) -> None:
2233 argname = fixture_def.argname
2234 if verbose <= 0 and argname.startswith("_"):
2235 return
2236 prettypath = _pretty_fixture_path(invocation_dir, fixture_def.func)
2237 tw.write(f"{argname}", green=True)
2238 tw.write(f" -- {prettypath}", yellow=True)
2239 tw.write("\n")
2240 fixture_doc = inspect.getdoc(fixture_def.func)
2241 if fixture_doc:
2242 write_docstring(
2243 tw,
2244 fixture_doc.split("\n\n", maxsplit=1)[0]
2245 if verbose <= 0
2246 else fixture_doc,
2247 )
2248 else:
2249 tw.line(" no docstring available", red=True)
2250
2251 def write_item(item: nodes.Item) -> None:
2252 fixturedefs = list(_get_fixtures_per_test(item))

Callers 1

write_itemFunction · 0.85

Calls 4

_pretty_fixture_pathFunction · 0.85
write_docstringFunction · 0.85
writeMethod · 0.45
lineMethod · 0.45

Tested by

no test coverage detected