diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 5c487e0b7..bf355b2af 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -33,7 +33,6 @@ from typing import Tuple from typing import TYPE_CHECKING from typing import TypeVar from typing import Union -import warnings import _pytest from _pytest import nodes @@ -57,10 +56,10 @@ from _pytest.config import _PluggyPlugin from _pytest.config import Config from _pytest.config import ExitCode from _pytest.config.argparsing import Parser +from _pytest.deprecated import _warn_auto_stacklevel from _pytest.deprecated import check_ispytest from _pytest.deprecated import MARKED_FIXTURE from _pytest.deprecated import YIELD_FIXTURE -from _pytest.deprecated import _warn_auto_stacklevel from _pytest.main import Session from _pytest.mark import Mark from _pytest.mark import ParameterSet diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 74344f199..fa50494f7 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -24,9 +24,9 @@ from ..compat import ascii_escaped from ..compat import NOTSET from ..compat import NotSetType from _pytest.config import Config +from _pytest.deprecated import _warn_auto_stacklevel from _pytest.deprecated import check_ispytest from _pytest.deprecated import MARKED_FIXTURE -from _pytest.deprecated import _warn_auto_stacklevel from _pytest.outcomes import fail from _pytest.scope import _ScopeName from _pytest.warning_types import PytestUnknownMarkWarning diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index bb748aa64..4c9248010 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -193,10 +193,12 @@ def test_fixture_disallow_on_marked_functions(): pytest.PytestRemovedIn9Warning, match=r"Marks applied to fixtures have no effect", ) as record: + @pytest.mark.parametrize("example", ["hello"]) @pytest.fixture def foo(): raise NotImplementedError() + assert len(record) == 1 assert record[0].filename == __file__