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

Method test_collect_topdir

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

Source from the content-addressed store, hash-verified

498
499class TestSession:
500 def test_collect_topdir(self, pytester: Pytester) -> None:
501 p = pytester.makepyfile("def test_func(): pass")
502 id = "::".join([p.name, "test_func"])
503 # XXX migrate to collectonly? (see below)
504 config = pytester.parseconfig(id)
505 topdir = pytester.path
506 rcol = Session.from_config(config)
507 assert topdir == rcol.path
508 # rootid = rcol.nodeid
509 # root2 = rcol.perform_collect([rcol.nodeid], genitems=False)[0]
510 # assert root2 == rcol, rootid
511 colitems = rcol.perform_collect([rcol.nodeid], genitems=False)
512 assert len(colitems) == 1
513 assert colitems[0].path == topdir
514
515 def get_reported_items(self, hookrec: HookRecorder) -> list[Item]:
516 """Return pytest.Item instances reported by the pytest_collectreport hook"""

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected