Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
tests: fix class-scoped fixtures defined as instance methods
  • Loading branch information
polkorny committed Jul 31, 2026
commit 0865a2c7cc572754902eaa40b295092a1156c499
9 changes: 6 additions & 3 deletions tests/unit/templating/test_media_types_finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/templating/test_responses_finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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):
Expand Down