reshape typing for hook invocation proxying
This commit is contained in:
		
							parent
							
								
									a550db4b6c
								
							
						
					
					
						commit
						2994022753
					
				| 
						 | 
					@ -1,12 +1,9 @@
 | 
				
			||||||
from typing import TYPE_CHECKING
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
from _pytest.nodes import _imply_path
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if TYPE_CHECKING:
 | 
					 | 
				
			||||||
    from ..compat import LEGACY_PATH
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import functools
 | 
					import functools
 | 
				
			||||||
 | 
					from pathlib import Path
 | 
				
			||||||
 | 
					from typing import Optional
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from ..compat import LEGACY_PATH
 | 
				
			||||||
 | 
					from _pytest.nodes import _imply_path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# hookname: (Path, LEGACY_PATH)
 | 
					# hookname: (Path, LEGACY_PATH)
 | 
				
			||||||
imply_paths_hooks = {
 | 
					imply_paths_hooks = {
 | 
				
			||||||
| 
						 | 
					@ -31,8 +28,8 @@ class PathAwareHookProxy:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            @functools.wraps(hook)
 | 
					            @functools.wraps(hook)
 | 
				
			||||||
            def fixed_hook(**kw):
 | 
					            def fixed_hook(**kw):
 | 
				
			||||||
                path_value = kw.pop(path_var, None)
 | 
					                path_value: Optional[Path] = kw.pop(path_var, None)
 | 
				
			||||||
                fspath_value: "LEGACY_PATH" = kw.pop(fspath_var, None)
 | 
					                fspath_value: Optional[LEGACY_PATH] = kw.pop(fspath_var, None)
 | 
				
			||||||
                path_value, fspath_value = _imply_path(path_value, fspath_value)
 | 
					                path_value, fspath_value = _imply_path(path_value, fspath_value)
 | 
				
			||||||
                kw[path_var] = path_value
 | 
					                kw[path_var] = path_value
 | 
				
			||||||
                kw[fspath_var] = fspath_value
 | 
					                kw[fspath_var] = fspath_value
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue