From 38f456148a5d3481843f5bd725ebfb47b136c79d Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sun, 6 Mar 2022 21:58:06 +0100 Subject: [PATCH] FIXUP: rebase issues and typing --- extra/setup-py.test/setup.py | 1 + src/_pytest/config/__init__.py | 6 +++--- src/_pytest/deprecated.py | 2 +- testing/test_recwarn.py | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extra/setup-py.test/setup.py b/extra/setup-py.test/setup.py index d0560ce1f5..97883852e2 100644 --- a/extra/setup-py.test/setup.py +++ b/extra/setup-py.test/setup.py @@ -1,4 +1,5 @@ import sys + from distutils.core import setup if __name__ == "__main__": diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 9abd592efd..087620783d 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -341,7 +341,7 @@ def _get_directory(path: Path) -> Path: def _get_legacy_hook_marks( - method: FunctionType, + method: object, # using object to avoid function type excess hook_type: str, opt_names: Tuple[str, ...], ) -> Dict[str, bool]: @@ -359,10 +359,10 @@ def _get_legacy_hook_marks( hook_opts = ", ".join(f"{name}=True" for name, val in opts.items() if val) message = _pytest.deprecated.HOOK_LEGACY_MARKING.format( type=hook_type, - fullname=method.__qualname__, + fullname=method.__qualname__, # type: ignore hook_opts=hook_opts, ) - warn_explicit_for(method, message) + warn_explicit_for(cast(FunctionType, method), message) return opts diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index f5b6ed10af..623bb02365 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -97,7 +97,7 @@ INSTANCE_COLLECTOR = PytestRemovedIn8Warning( "The pytest.Instance collector type is deprecated and is no longer used. " "See https://docs.pytest.org/en/latest/deprecations.html#the-pytest-instance-collector", - +) HOOK_LEGACY_MARKING = UnformattedWarning( PytestDeprecationWarning, "The hook{type} {fullname} uses old-style configuration options (marks or attributes).\n" diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index 7c825171e0..7e0f836a63 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -1,4 +1,3 @@ - import warnings from typing import Optional