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

Method test_collect_topdir

testing/test_collection.py:470–483  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

468
469class TestSession:
470 def test_collect_topdir(self, pytester: Pytester) -> None:
471 p = pytester.makepyfile("def test_func(): pass")
472 id = "::".join([p.name, "test_func"])
473 # XXX migrate to collectonly? (see below)
474 config = pytester.parseconfig(id)
475 topdir = pytester.path
476 rcol = Session.from_config(config)
477 assert topdir == rcol.path
478 # rootid = rcol.nodeid
479 # root2 = rcol.perform_collect([rcol.nodeid], genitems=False)[0]
480 # assert root2 == rcol, rootid
481 colitems = rcol.perform_collect([rcol.nodeid], genitems=False)
482 assert len(colitems) == 1
483 assert colitems[0].path == p
484
485 def get_reported_items(self, hookrec: HookRecorder) -> List[Item]:
486 """Return pytest.Item instances reported by the pytest_collectreport hook"""

Callers

nothing calls this directly

Calls 4

perform_collectMethod · 0.80
makepyfileMethod · 0.45
parseconfigMethod · 0.45
from_configMethod · 0.45

Tested by

no test coverage detected