Skip to content

Commit 2994022

Browse files
reshape typing for hook invocation proxying
1 parent a550db4 commit 2994022

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/_pytest/config/compat.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
from typing import TYPE_CHECKING
1+
import functools
2+
from pathlib import Path
3+
from typing import Optional
24

5+
from ..compat import LEGACY_PATH
36
from _pytest.nodes import _imply_path
47

5-
if TYPE_CHECKING:
6-
from ..compat import LEGACY_PATH
7-
8-
9-
import functools
10-
118
# hookname: (Path, LEGACY_PATH)
129
imply_paths_hooks = {
1310
"pytest_ignore_collect": ("fspath", "path"),
@@ -31,8 +28,8 @@ def __getattr__(self, key):
3128

3229
@functools.wraps(hook)
3330
def fixed_hook(**kw):
34-
path_value = kw.pop(path_var, None)
35-
fspath_value: "LEGACY_PATH" = kw.pop(fspath_var, None)
31+
path_value: Optional[Path] = kw.pop(path_var, None)
32+
fspath_value: Optional[LEGACY_PATH] = kw.pop(fspath_var, None)
3633
path_value, fspath_value = _imply_path(path_value, fspath_value)
3734
kw[path_var] = path_value
3835
kw[fspath_var] = fspath_value

0 commit comments

Comments
 (0)