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

Function test__check_initialpaths_for_relpath

testing/test_nodes.py:116–137  ·  view source on GitHub ↗

Ensure that it handles dirs, and does not always use dirname.

()

Source from the content-addressed store, hash-verified

114
115
116def test__check_initialpaths_for_relpath() -> None:
117 """Ensure that it handles dirs, and does not always use dirname."""
118 cwd = Path.cwd()
119
120 class FakeSession1:
121 _initialpaths = frozenset({cwd})
122
123 session = cast(pytest.Session, FakeSession1)
124
125 assert nodes._check_initialpaths_for_relpath(session, cwd) == ""
126
127 sub = cwd / "file"
128
129 class FakeSession2:
130 _initialpaths = frozenset({cwd})
131
132 session = cast(pytest.Session, FakeSession2)
133
134 assert nodes._check_initialpaths_for_relpath(session, sub) == "file"
135
136 outside = Path("/outside-this-does-not-exist")
137 assert nodes._check_initialpaths_for_relpath(session, outside) is None
138
139
140def test_failure_with_changed_cwd(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected