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

Method test_global_file

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

Source from the content-addressed store, hash-verified

686
687class Test_getinitialnodes:
688 def test_global_file(self, pytester: Pytester) -> None:
689 tmp_path = pytester.path
690 x = ensure_file(tmp_path / "x.py")
691 config = pytester.parseconfigure(x)
692 col = pytester.getnode(config, x)
693 assert isinstance(col, pytest.Module)
694 assert col.name == "x.py"
695 assert col.parent is not None
696 assert col.parent.parent is not None
697 assert col.parent.parent.parent is None
698 for parent in col.listchain():
699 assert parent.config is config
700
701 def test_pkgfile(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
702 """Verify nesting when a module is within a package.

Callers

nothing calls this directly

Calls 4

ensure_fileFunction · 0.85
listchainMethod · 0.80
parseconfigureMethod · 0.45
getnodeMethod · 0.45

Tested by

no test coverage detected