Skip to content

Commit 0cbab14

Browse files
committed
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.
1 parent 0337b43 commit 0cbab14

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

tests/unit/templating/test_media_types_finders.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77

88
class TestMediaTypes:
99
@pytest.fixture(scope="class")
10-
def spec(self):
10+
@classmethod
11+
def spec(cls):
1112
return {
1213
"application/json": {"schema": {"type": "object"}},
1314
"text/*": {"schema": {"type": "object"}},
1415
}
1516

1617
@pytest.fixture(scope="class")
17-
def content(self, spec):
18+
@classmethod
19+
def content(cls, spec):
1820
return SchemaPath.from_dict(spec)
1921

2022
@pytest.fixture(scope="class")
21-
def finder(self, content):
23+
@classmethod
24+
def finder(cls, content):
2225
return MediaTypeFinder(content)
2326

2427
@pytest.mark.parametrize(

tests/unit/templating/test_responses_finders.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
class TestResponses:
1010
@pytest.fixture(scope="class")
11-
def spec(self):
11+
@classmethod
12+
def spec(cls):
1213
return {
1314
"200": mock.sentinel.response_200,
1415
"299": mock.sentinel.response_299,
@@ -17,11 +18,13 @@ def spec(self):
1718
}
1819

1920
@pytest.fixture(scope="class")
20-
def responses(self, spec):
21+
@classmethod
22+
def responses(cls, spec):
2123
return SchemaPath.from_dict(spec)
2224

2325
@pytest.fixture(scope="class")
24-
def finder(self, responses):
26+
@classmethod
27+
def finder(cls, responses):
2528
return ResponseFinder(responses)
2629

2730
def test_default(self, finder, responses):

0 commit comments

Comments
 (0)