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

Function write_fixture

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

Source from the content-addressed store, hash-verified

1488 return bestrelpath(curdir, Path(loc))
1489
1490 def write_fixture(fixture_def: fixtures.FixtureDef[object]) -> None:
1491 argname = fixture_def.argname
1492 if verbose <= 0 and argname.startswith("_"):
1493 return
1494 prettypath = _pretty_fixture_path(fixture_def.func)
1495 tw.write(f"{argname}", green=True)
1496 tw.write(f" -- {prettypath}", yellow=True)
1497 tw.write("\n")
1498 fixture_doc = inspect.getdoc(fixture_def.func)
1499 if fixture_doc:
1500 write_docstring(
1501 tw, fixture_doc.split("\n\n")[0] if verbose <= 0 else fixture_doc
1502 )
1503 else:
1504 tw.line(" no docstring available", red=True)
1505
1506 def write_item(item: nodes.Item) -> None:
1507 # Not all items have _fixtureinfo attribute.

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