nodes: inline _imply_path

Only one usage left, and we certainly don't expect more!

Rename `_imply_path_only` to `_imply_path`, that's a less confusing name
now.
This commit is contained in:
Ran Benita
2021-10-23 21:40:57 +03:00
parent 6be3f31dba
commit afc7442e22
2 changed files with 14 additions and 21 deletions
+11 -2
View File
@@ -4,8 +4,9 @@ from pathlib import Path
from typing import Optional
from ..compat import LEGACY_PATH
from ..compat import legacy_path
from ..deprecated import HOOK_LEGACY_PATH_ARG
from _pytest.nodes import _imply_path
from _pytest.nodes import _check_path
# hookname: (Path, LEGACY_PATH)
imply_paths_hooks = {
@@ -52,7 +53,15 @@ class PathAwareHookProxy:
),
stacklevel=2,
)
path_value, fspath_value = _imply_path(path_value, fspath_value)
if path_value is not None:
if fspath_value is not None:
_check_path(path_value, fspath_value)
else:
fspath_value = legacy_path(path_value)
else:
assert fspath_value is not None
path_value = Path(fspath_value)
kw[path_var] = path_value
kw[fspath_var] = fspath_value
return hook(**kw)