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

Method test_does_not_exist

testing/test_main.py:263–276  ·  view source on GitHub ↗

Given a file/module that does not exist raises UsageError.

(self, invocation_path: Path)

Source from the content-addressed store, hash-verified

261 resolve_collection_argument(invocation_path, arg, 0)
262
263 def test_does_not_exist(self, invocation_path: Path) -> None:
264 """Given a file/module that does not exist raises UsageError."""
265 with pytest.raises(
266 UsageError, match=re.escape("file or directory not found: foobar")
267 ):
268 resolve_collection_argument(invocation_path, "foobar", 0)
269
270 with pytest.raises(
271 UsageError,
272 match=re.escape(
273 "module or package not found: foobar (missing __init__.py?)"
274 ),
275 ):
276 resolve_collection_argument(invocation_path, "foobar", 0, as_pypath=True)
277
278 def test_absolute_paths_are_resolved_correctly(self, invocation_path: Path) -> None:
279 """Absolute paths resolve back to absolute paths."""

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected