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

Method test_pypath

testing/test_main.py:154–172  ·  view source on GitHub ↗

Dotted name and parts.

(self, invocation_path: Path)

Source from the content-addressed store, hash-verified

152 resolve_collection_argument(invocation_path, "src/pkg::foo::bar")
153
154 def test_pypath(self, invocation_path: Path) -> None:
155 """Dotted name and parts."""
156 assert resolve_collection_argument(
157 invocation_path, "pkg.test", as_pypath=True
158 ) == (invocation_path / "src/pkg/test.py", [])
159 assert resolve_collection_argument(
160 invocation_path, "pkg.test::foo::bar", as_pypath=True
161 ) == (invocation_path / "src/pkg/test.py", ["foo", "bar"])
162 assert resolve_collection_argument(invocation_path, "pkg", as_pypath=True) == (
163 invocation_path / "src/pkg",
164 [],
165 )
166
167 with pytest.raises(
168 UsageError, match=r"package argument cannot contain :: selection parts"
169 ):
170 resolve_collection_argument(
171 invocation_path, "pkg::foo::bar", as_pypath=True
172 )
173
174 def test_does_not_exist(self, invocation_path: Path) -> None:
175 """Given a file/module that does not exist raises UsageError."""

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected