File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -344,10 +344,13 @@ def _get_directory(path: Path) -> Path:
344
344
345
345
346
346
def _get_legacy_hook_marks (
347
- method : object , # using object to avoid function type excess
347
+ method : Any ,
348
348
hook_type : str ,
349
349
opt_names : Tuple [str , ...],
350
350
) -> Dict [str , bool ]:
351
+ if TYPE_CHECKING :
352
+ # abuse typeguard from importlib to avoid massive method type union thats lacking a alias
353
+ assert inspect .isroutine (method )
351
354
known_marks : set [str ] = {m .name for m in getattr (method , "pytestmark" , [])}
352
355
must_warn : list [str ] = []
353
356
opts : dict [str , bool ] = {}
@@ -365,7 +368,7 @@ def _get_legacy_hook_marks(
365
368
hook_opts = ", " .join (must_warn )
366
369
message = _pytest .deprecated .HOOK_LEGACY_MARKING .format (
367
370
type = hook_type ,
368
- fullname = method .__qualname__ , # type: ignore
371
+ fullname = method .__qualname__ ,
369
372
hook_opts = hook_opts ,
370
373
)
371
374
warn_explicit_for (cast (FunctionType , method ), message )
You can’t perform that action at this time.
0 commit comments