From 0cbab14e03c6a9f64be2df51e0c86401f791feca Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 29 Jun 2026 11:58:41 +0100 Subject: [PATCH] Don't define class-scoped fixtures as instance methods This is deprecated as of pytest 9.1; see https://docs.pytest.org/en/stable/deprecations.html#class-scoped-fixture-as-instance-method. --- tests/unit/templating/test_media_types_finders.py | 9 ++++++--- tests/unit/templating/test_responses_finders.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/unit/templating/test_media_types_finders.py b/tests/unit/templating/test_media_types_finders.py index d83cc1f1..46698a5a 100644 --- a/tests/unit/templating/test_media_types_finders.py +++ b/tests/unit/templating/test_media_types_finders.py @@ -7,18 +7,21 @@ class TestMediaTypes: @pytest.fixture(scope="class") - def spec(self): + @classmethod + def spec(cls): return { "application/json": {"schema": {"type": "object"}}, "text/*": {"schema": {"type": "object"}}, } @pytest.fixture(scope="class") - def content(self, spec): + @classmethod + def content(cls, spec): return SchemaPath.from_dict(spec) @pytest.fixture(scope="class") - def finder(self, content): + @classmethod + def finder(cls, content): return MediaTypeFinder(content) @pytest.mark.parametrize( diff --git a/tests/unit/templating/test_responses_finders.py b/tests/unit/templating/test_responses_finders.py index 5aac4fbc..8fd2f858 100644 --- a/tests/unit/templating/test_responses_finders.py +++ b/tests/unit/templating/test_responses_finders.py @@ -8,7 +8,8 @@ class TestResponses: @pytest.fixture(scope="class") - def spec(self): + @classmethod + def spec(cls): return { "200": mock.sentinel.response_200, "299": mock.sentinel.response_299, @@ -17,11 +18,13 @@ def spec(self): } @pytest.fixture(scope="class") - def responses(self, spec): + @classmethod + def responses(cls, spec): return SchemaPath.from_dict(spec) @pytest.fixture(scope="class") - def finder(self, responses): + @classmethod + def finder(cls, responses): return ResponseFinder(responses) def test_default(self, finder, responses):