From 45f1a462d505438548a4dda2072093a22fbd1cb3 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sun, 25 Jun 2023 16:08:53 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Zac Hatfield-Dodds --- doc/en/how-to/fixtures.rst | 2 +- src/_pytest/deprecated.py | 2 +- testing/deprecated_test.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index e9f7f2d4b..c6047af12 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -1752,7 +1752,7 @@ into an ini-file: def my_fixture_that_sadly_wont_use_my_other_fixture(): ... - Currently this will generate a deprecation warning. + This generates a deprecation warning, and will become an error in Pytest 8. .. _`override fixtures`: diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 5874eeb99..3fcf99ba4 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -122,7 +122,7 @@ HOOK_LEGACY_MARKING = UnformattedWarning( "#configuring-hook-specs-impls-using-markers", ) -MARKED_FIXTURE = PytestDeprecationWarning( +MARKED_FIXTURE = PytestRemovedIn8Warning( "Marks applied to fixtures have no effect\n" "See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function" ) diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index cf067bac9..f4197a1f6 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -284,7 +284,7 @@ def test_importing_instance_is_deprecated(pytester: Pytester) -> None: def test_fixture_disallow_on_marked_functions(): """Test that applying @pytest.fixture to a marked function warns (#3364).""" with pytest.warns( - pytest.PytestDeprecationWarning, + pytest.PytestRemovedIn8Warning, match=r"Marks applied to fixtures have no effect", ) as record: @@ -303,7 +303,7 @@ def test_fixture_disallow_on_marked_functions(): def test_fixture_disallow_marks_on_fixtures(): """Test that applying a mark to a fixture warns (#3364).""" with pytest.warns( - pytest.PytestDeprecationWarning, + pytest.PytestRemovedIn8Warning, match=r"Marks applied to fixtures have no effect", ) as record: @@ -319,7 +319,7 @@ def test_fixture_disallow_marks_on_fixtures(): def test_fixture_disallowed_between_marks(): """Test that applying a mark to a fixture warns (#3364).""" with pytest.warns( - pytest.PytestDeprecationWarning, + pytest.PytestRemovedIn8Warning, match=r"Marks applied to fixtures have no effect", ) as record: