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

Method test_collect_two_commandline_args

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

Source from the content-addressed store, hash-verified

587 )
588
589 def test_collect_two_commandline_args(self, pytester: Pytester) -> None:
590 p = pytester.makepyfile("def test_func(): pass")
591 aaa = pytester.mkpydir("aaa")
592 bbb = pytester.mkpydir("bbb")
593 test_aaa = aaa.joinpath("test_aaa.py")
594 shutil.copy(p, test_aaa)
595 test_bbb = bbb.joinpath("test_bbb.py")
596 p.replace(test_bbb)
597
598 id = "."
599
600 items, hookrec = pytester.inline_genitems(id)
601 assert len(items) == 2
602 pprint.pprint(hookrec.calls)
603 hookrec.assert_contains(
604 [
605 ("pytest_collectstart", "collector.path == test_aaa"),
606 ("pytest_pycollect_makeitem", "name == 'test_func'"),
607 ("pytest_collectreport", "report.nodeid == 'aaa/test_aaa.py'"),
608 ("pytest_collectstart", "collector.path == test_bbb"),
609 ("pytest_pycollect_makeitem", "name == 'test_func'"),
610 ("pytest_collectreport", "report.nodeid == 'bbb/test_bbb.py'"),
611 ]
612 )
613
614 def test_serialization_byid(self, pytester: Pytester) -> None:
615 pytester.makepyfile("def test_func(): pass")

Callers

nothing calls this directly

Calls 4

assert_containsMethod · 0.80
makepyfileMethod · 0.45
mkpydirMethod · 0.45
inline_genitemsMethod · 0.45

Tested by

no test coverage detected