Skip to content

Commit

Permalink
Ruff: Add and fix PLW0604
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Feb 12, 2025
1 parent 0aec2f9 commit 4daed0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
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", "PLR0203", "PLR0206", "PLR04", "PLR0915", "PLR1716", "PLR172", "PLR1733", "PLR1736", "PLR6201",
"PLW0108", "PLW0120", "PLW0127", "PLW0129", "PLW013", "PLW017", "PLW02", "PLW04", "PLW07", "PLW1", "PLW2", "PLW3",
"PLW0108", "PLW0120", "PLW0127", "PLW0129", "PLW013", "PLW017", "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

0 comments on commit 4daed0c

Please sign in to comment.