Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruff: Add and fix PLW0604 #11773

Merged
merged 1 commit into from
Feb 19, 2025
Merged
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
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ select = [
"PLC01", "PLC0205", "PLC0208", "PLC0414", "PLC18", "PLC24", "PLC3",
"PLE",
"PLR01", "PLR02", "PLR04", "PLR0915", "PLR1716", "PLR172", "PLR1733", "PLR1736", "PLR5", "PLR6104", "PLR6201",
"PLW01", "PLW02", "PLW04", "PLW07", "PLW1", "PLW2", "PLW3",
"PLW01", "PLW02", "PLW04", "PLW0604", "PLW07", "PLW1", "PLW2", "PLW3",
"TRY003", "TRY004", "TRY2", "TRY300", "TRY401",
"FLY",
"NPY",
Expand Down
11 changes: 4 additions & 7 deletions unittests/test_rest_framework.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
import json
import logging
import pathlib
Expand Down Expand Up @@ -151,6 +152,7 @@
REIMPORTER_MOCK_RETURN_VALUE = None, 0, 0, 0, 0, 0, MagicMock()


@functools.cache
def get_open_api3_json_schema():
generator_class = spectacular_settings.DEFAULT_GENERATOR_CLASS
generator = generator_class()
Expand All @@ -163,11 +165,6 @@ def get_open_api3_json_schema():
return schema


# use ugly global to avoid generating the schema for every test/method (as it's slow)
global open_api3_json_schema
open_api3_json_schema = get_open_api3_json_schema()


def skipIfNotSubclass(baseclass):
def decorate(f):
def wrapper(self, *args, **kwargs):
Expand Down Expand Up @@ -363,7 +360,7 @@ def setUp(self):
self.client = APIClient()
self.client.credentials(HTTP_AUTHORIZATION="Token " + token.key)
self.url = reverse(self.viewname + "-list")
self.schema = open_api3_json_schema
self.schema = get_open_api3_json_schema()

def setUp_not_authorized(self):
testuser = User.objects.get(id=3)
Expand Down Expand Up @@ -465,7 +462,7 @@ def test_detail_configuration_not_authorized(self):
class ListRequestTest(RESTEndpointTest):
@skipIfNotSubclass(ListModelMixin)
def test_list(self):
# print(open_api3_json_schema)
# print(get_open_api3_json_schema())
# validator = ResponseValidator(spec)

check_for_tags = False
Expand Down