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

Function collect

src/_pytest/runner.py:389–406  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

387
388def pytest_make_collect_report(collector: Collector) -> CollectReport:
389 def collect() -> list[Item | Collector]:
390 # Before collecting, if this is a Directory, load the conftests.
391 # If a conftest import fails to load, it is considered a collection
392 # error of the Directory collector. This is why it's done inside of the
393 # CallInfo wrapper.
394 #
395 # Note: initial conftests are loaded early, not here.
396 if isinstance(collector, Directory):
397 collector.config.pluginmanager._loadconftestmodules(
398 collector.path,
399 collector.config.getoption("importmode"),
400 rootpath=collector.config.rootpath,
401 consider_namespace_packages=collector.config.getini(
402 "consider_namespace_packages"
403 ),
404 )
405
406 return list(collector.collect())
407
408 call = CallInfo.from_call(
409 collect, "collect", reraise=(KeyboardInterrupt, SystemExit)

Callers

nothing calls this directly

Calls 4

_loadconftestmodulesMethod · 0.80
getoptionMethod · 0.80
getiniMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected