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 9, 2025
1 parent 88e0409 commit c9f9fc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 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", "PLR0915", "PLR1716", "PLR172", "PLR1733", "PLR1736",
"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
12 changes: 4 additions & 8 deletions unittests/test_rest_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from collections import OrderedDict
from enum import Enum
from json import dumps
import functools

# from drf_spectacular.renderers import OpenApiJsonRenderer
from unittest.mock import ANY, MagicMock, call, patch
Expand Down Expand Up @@ -150,7 +151,7 @@
IMPORTER_MOCK_RETURN_VALUE = None, 0, 0, 0, 0, 0, MagicMock()
REIMPORTER_MOCK_RETURN_VALUE = None, 0, 0, 0, 0, 0, MagicMock()


@functools.cache

Check failure on line 154 in unittests/test_rest_framework.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (E302)

unittests/test_rest_framework.py:154:1: E302 Expected 2 blank lines, found 1
def get_open_api3_json_schema():
generator_class = spectacular_settings.DEFAULT_GENERATOR_CLASS
generator = generator_class()
Expand All @@ -163,11 +164,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 +359,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 +461,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 c9f9fc3

Please sign in to comment.