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

Function write_item

src/_pytest/python.py:1506–1522  ·  view source on GitHub ↗
(item: nodes.Item)

Source from the content-addressed store, hash-verified

1504 tw.line(" no docstring available", red=True)
1505
1506 def write_item(item: nodes.Item) -> None:
1507 # Not all items have _fixtureinfo attribute.
1508 info: Optional[FuncFixtureInfo] = getattr(item, "_fixtureinfo", None)
1509 if info is None or not info.name2fixturedefs:
1510 # This test item does not use any fixtures.
1511 return
1512 tw.line()
1513 tw.sep("-", f"fixtures used by {item.name}")
1514 # TODO: Fix this type ignore.
1515 tw.sep("-", f"({get_best_relpath(item.function)})") # type: ignore[attr-defined]
1516 # dict key not used in loop but needed for sorting.
1517 for _, fixturedefs in sorted(info.name2fixturedefs.items()):
1518 assert fixturedefs is not None
1519 if not fixturedefs:
1520 continue
1521 # Last item is expected to be the one used by the test item.
1522 write_fixture(fixturedefs[-1])
1523
1524 for session_item in session.items:
1525 write_item(session_item)

Callers 1

_show_fixtures_per_testFunction · 0.85

Calls 4

get_best_relpathFunction · 0.85
write_fixtureFunction · 0.85
lineMethod · 0.45
sepMethod · 0.45

Tested by

no test coverage detected