From a8c86be660462bfcea6e2397e408c5f29f25a1f9 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Tue, 22 Oct 2019 11:18:51 -0700 Subject: [PATCH] Update linter requirements (#7010) --- requirements/requirements-codestyle.txt | 8 +++---- rest_framework/schemas/__init__.py | 2 +- setup.cfg | 2 +- tests/schemas/test_coreapi.py | 2 +- tests/test_permissions.py | 32 ++++++++++++------------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt index 8cbd41c50..482deac66 100644 --- a/requirements/requirements-codestyle.txt +++ b/requirements/requirements-codestyle.txt @@ -1,7 +1,7 @@ # PEP8 code linting, which we run on all commits. -flake8==3.5.0 -flake8-tidy-imports==1.1.0 -pycodestyle==2.3.1 +flake8==3.7.8 +flake8-tidy-imports==3.0.0 +pycodestyle==2.5.0 # Sort and lint imports -isort==4.3.3 +isort==4.3.21 diff --git a/rest_framework/schemas/__init__.py b/rest_framework/schemas/__init__.py index 588680362..b63cb2353 100644 --- a/rest_framework/schemas/__init__.py +++ b/rest_framework/schemas/__init__.py @@ -23,8 +23,8 @@ Other access should target the submodules directly from rest_framework.settings import api_settings from . import coreapi, openapi -from .inspectors import DefaultSchema # noqa from .coreapi import AutoSchema, ManualSchema, SchemaGenerator # noqa +from .inspectors import DefaultSchema # noqa def get_schema_view( diff --git a/setup.cfg b/setup.cfg index c021fdde0..81da18b1c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ addopts=--tb=short --strict -ra testspath = tests [flake8] -ignore = E501 +ignore = E501,W504 banned-modules = json = use from rest_framework.utils import json! [isort] diff --git a/tests/schemas/test_coreapi.py b/tests/schemas/test_coreapi.py index 66275ade9..a634d6968 100644 --- a/tests/schemas/test_coreapi.py +++ b/tests/schemas/test_coreapi.py @@ -24,8 +24,8 @@ from rest_framework.utils import formatting from rest_framework.views import APIView from rest_framework.viewsets import GenericViewSet, ModelViewSet -from . import views from ..models import BasicModel, ForeignKeySource, ManyToManySource +from . import views factory = APIRequestFactory() diff --git a/tests/test_permissions.py b/tests/test_permissions.py index 03b80aae8..b6178c0bb 100644 --- a/tests/test_permissions.py +++ b/tests/test_permissions.py @@ -494,28 +494,28 @@ class CustomPermissionsTests(TestCase): self.custom_message = 'Custom: You cannot access this resource' def test_permission_denied(self): - response = denied_view(self.request, pk=1) - detail = response.data.get('detail') - self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) - self.assertNotEqual(detail, self.custom_message) + response = denied_view(self.request, pk=1) + detail = response.data.get('detail') + self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) + self.assertNotEqual(detail, self.custom_message) def test_permission_denied_with_custom_detail(self): - response = denied_view_with_detail(self.request, pk=1) - detail = response.data.get('detail') - self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) - self.assertEqual(detail, self.custom_message) + response = denied_view_with_detail(self.request, pk=1) + detail = response.data.get('detail') + self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) + self.assertEqual(detail, self.custom_message) def test_permission_denied_for_object(self): - response = denied_object_view(self.request, pk=1) - detail = response.data.get('detail') - self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) - self.assertNotEqual(detail, self.custom_message) + response = denied_object_view(self.request, pk=1) + detail = response.data.get('detail') + self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) + self.assertNotEqual(detail, self.custom_message) def test_permission_denied_for_object_with_custom_detail(self): - response = denied_object_view_with_detail(self.request, pk=1) - detail = response.data.get('detail') - self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) - self.assertEqual(detail, self.custom_message) + response = denied_object_view_with_detail(self.request, pk=1) + detail = response.data.get('detail') + self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) + self.assertEqual(detail, self.custom_message) class PermissionsCompositionTests(TestCase):