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

Function get_dirs_from_args

src/_pytest/config/findpaths.py:231–250  ·  view source on GitHub ↗
(args: Iterable[str])

Source from the content-addressed store, hash-verified

229
230
231def get_dirs_from_args(args: Iterable[str]) -> list[Path]:
232 def is_option(x: str) -> bool:
233 return x.startswith("-")
234
235 def get_file_part_from_node_id(x: str) -> str:
236 return x.split("::", maxsplit=1)[0]
237
238 def get_dir_from_path(path: Path) -> Path:
239 if path.is_dir():
240 return path
241 return path.parent
242
243 # These look like paths but may not exist
244 possible_paths = (
245 absolutepath(get_file_part_from_node_id(arg))
246 for arg in args
247 if not is_option(arg)
248 )
249
250 return [get_dir_from_path(path) for path in possible_paths if safe_exists(path)]
251
252
253def parse_override_ini(override_ini: Sequence[str] | None) -> ConfigDict:

Callers 2

test_get_dirs_from_argsFunction · 0.90
determine_setupFunction · 0.85

Calls 5

absolutepathFunction · 0.90
safe_existsFunction · 0.90
is_optionFunction · 0.85
get_dir_from_pathFunction · 0.85

Tested by 1

test_get_dirs_from_argsFunction · 0.72