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

Function directory_arg

src/_pytest/config/__init__.py:294–302  ·  view source on GitHub ↗

Argparse type validator for directory arguments. :path: Path of directory. :optname: Name of the option.

(path: str, optname: str)

Source from the content-addressed store, hash-verified

292
293
294def directory_arg(path: str, optname: str) -> str:
295 """Argparse type validator for directory arguments.
296
297 :path: Path of directory.
298 :optname: Name of the option.
299 """
300 if not os.path.isdir(path):
301 raise UsageError(f"{optname} must be a directory, given: {path}")
302 return path
303
304
305# Plugins that cannot be disabled via "-p no:X" currently.

Callers

nothing calls this directly

Calls 2

UsageErrorClass · 0.85
isdirMethod · 0.45

Tested by

no test coverage detected