FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

tests: fix class-scoped fixtures defined as instance methods by polkorny · Pull Request #1218 · python-openapi/openapi-core · GitHub

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

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 6 additions & 3 deletions tests/unit/templating/test_media_types_finders.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL