diff --git a/requirements.txt b/requirements.txt index 2e46b26d..96bb148f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,9 +34,9 @@ venusian==3.1.0 \ --hash=sha256:d1fb1e49927f42573f6c9b7c4fcf61c892af8fdcaa2314daa01d9a560b23488d \ --hash=sha256:eb72cdca6f3139a15dc80f9c95d3c10f8a54a0ba881eeef8e2ec5b42d3ee3a95 # via pyramid -webob==1.8.7 \ - --hash=sha256:73aae30359291c14fa3b956f8b5ca31960e420c28c1bec002547fb04928cf89b \ - --hash=sha256:b64ef5141be559cfade448f044fa45c2260351edcb6a8ef6b7e00c7dcef0c323 +webob==1.8.8 \ + --hash=sha256:2abc1555e118fc251e705fc6dc66c7f5353bb9fbfab6d20e22f1c02b4b71bcee \ + --hash=sha256:b60ba63f05c0cf61e086a10c3781a41fcfe30027753a8ae6d819c77592ce83ea # via pyramid zope-deprecation==5.0 \ --hash=sha256:28c2ee983812efb4676d33c7a8c6ade0df191c1c6d652bbbfe6e2eeee067b2d4 \ diff --git a/tests/support.py b/tests/support.py index e6a054e0..ff5a7f93 100644 --- a/tests/support.py +++ b/tests/support.py @@ -12,12 +12,13 @@ # Maybe we're running in python2.7? from unittest import TestCase # NOQA -from cornice.errors import Errors from pyramid import testing from pyramid.httpexceptions import HTTPException from webob import exc from webob.dec import wsgify +from cornice.errors import Errors + logger = logging.getLogger("cornice") diff --git a/tests/test_cors.py b/tests/test_cors.py index 12281fef..774ae586 100644 --- a/tests/test_cors.py +++ b/tests/test_cors.py @@ -1,7 +1,6 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -from cornice.service import Service from pyramid import testing from pyramid.authentication import BasicAuthAuthenticationPolicy from pyramid.exceptions import HTTPBadRequest, NotFound @@ -11,6 +10,8 @@ from webtest import TestApp from zope.interface import implementer +from cornice.service import Service + from .support import CatchErrors, TestCase diff --git a/tests/test_errors.py b/tests/test_errors.py index 93b8d641..1c2385e2 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -1,11 +1,12 @@ from unittest import mock -from cornice.errors import Errors -from cornice.service import Service from pyramid import testing from pyramid.i18n import TranslationString from webtest import TestApp +from cornice.errors import Errors +from cornice.service import Service + from .support import CatchErrors, TestCase diff --git a/tests/test_imperative_resource.py b/tests/test_imperative_resource.py index d6db0cb7..bc701666 100644 --- a/tests/test_imperative_resource.py +++ b/tests/test_imperative_resource.py @@ -5,7 +5,6 @@ from unittest import mock import pytest -from cornice.resource import add_resource, add_view from pyramid import testing from pyramid.authentication import AuthTktAuthenticationPolicy from pyramid.authorization import ACLAuthorizationPolicy @@ -13,6 +12,8 @@ from pyramid.security import Allow from webtest import TestApp +from cornice.resource import add_resource, add_view + from .support import CatchErrors, TestCase, dummy_factory diff --git a/tests/test_init.py b/tests/test_init.py index f3304336..054fced9 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -3,11 +3,12 @@ # You can obtain one at http://mozilla.org/MPL/2.0/. from unittest import mock -from cornice import Service -from cornice.pyramidhook import apply_filters from pyramid import testing from webtest import TestApp +from cornice import Service +from cornice.pyramidhook import apply_filters + from .support import CatchErrors, TestCase diff --git a/tests/test_renderer.py b/tests/test_renderer.py index c2b3118a..367f6224 100644 --- a/tests/test_renderer.py +++ b/tests/test_renderer.py @@ -1,11 +1,12 @@ from unittest import mock -from cornice import CorniceRenderer -from cornice.renderer import JSONError, bytes_adapter from pyramid.interfaces import IJSONAdapter from pyramid.renderers import JSON from zope.interface import providedBy +from cornice import CorniceRenderer +from cornice.renderer import JSONError, bytes_adapter + from .support import TestCase diff --git a/tests/test_resource.py b/tests/test_resource.py index 92db0561..6b329fa7 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -5,7 +5,6 @@ import json from unittest import mock -from cornice.resource import resource, view from pyramid import testing from pyramid.authentication import AuthTktAuthenticationPolicy from pyramid.authorization import ACLAuthorizationPolicy @@ -14,6 +13,8 @@ from pyramid.security import Allow from webtest import TestApp +from cornice.resource import resource, view + from .support import CatchErrors, TestCase, dummy_factory diff --git a/tests/test_resource_callable.py b/tests/test_resource_callable.py index 717f51d2..718121bd 100644 --- a/tests/test_resource_callable.py +++ b/tests/test_resource_callable.py @@ -3,10 +3,11 @@ import json -from cornice.resource import resource, view from pyramid import testing from webtest import TestApp +from cornice.resource import resource, view + from .support import CatchErrors, TestCase diff --git a/tests/test_resource_custom_predicates.py b/tests/test_resource_custom_predicates.py index 302716b5..7e4f78d1 100644 --- a/tests/test_resource_custom_predicates.py +++ b/tests/test_resource_custom_predicates.py @@ -1,12 +1,13 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -from cornice.resource import resource, view from pyramid import testing from pyramid.authentication import AuthTktAuthenticationPolicy from pyramid.authorization import ACLAuthorizationPolicy from webtest import TestApp +from cornice.resource import resource, view + from .support import CatchErrors, TestCase diff --git a/tests/test_resource_traverse.py b/tests/test_resource_traverse.py index 7ffd2ae6..934fce31 100644 --- a/tests/test_resource_traverse.py +++ b/tests/test_resource_traverse.py @@ -1,10 +1,11 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -from cornice.resource import resource, view from pyramid import testing from webtest import TestApp +from cornice.resource import resource, view + from .support import CatchErrors, TestCase diff --git a/tests/test_service.py b/tests/test_service.py index 82b6bcc9..e6ae2f23 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -3,11 +3,12 @@ # You can obtain one at http://mozilla.org/MPL/2.0/. from unittest import mock +from pyramid.exceptions import ConfigurationError +from pyramid.interfaces import IRendererFactory + from cornice.resource import resource from cornice.service import Service, _UnboundView, clear_services, decorate_view, get_services from cornice.util import func_name -from pyramid.exceptions import ConfigurationError -from pyramid.interfaces import IRendererFactory from .support import DummyRequest, TestCase diff --git a/tests/test_service_definition.py b/tests/test_service_definition.py index db943dcc..7c03ab62 100644 --- a/tests/test_service_definition.py +++ b/tests/test_service_definition.py @@ -2,10 +2,11 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -from cornice import Service from pyramid import testing from webtest import TestApp +from cornice import Service + from .support import CatchErrors, TestCase diff --git a/tests/test_validation.py b/tests/test_validation.py index 96c325ed..63ae0ecb 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -784,16 +784,18 @@ def test_no_body_schema(self): self.assertEqual(len(request.errors), 0) def test_message_normalizer_no_field_names(self): - from cornice.validators._marshmallow import _message_normalizer from marshmallow.exceptions import ValidationError + from cornice.validators._marshmallow import _message_normalizer + parsed = _message_normalizer(ValidationError("Test message")) self.assertEqual({"_schema": ["Test message"]}, parsed) def test_message_normalizer_field_names(self): - from cornice.validators._marshmallow import _message_normalizer from marshmallow.exceptions import ValidationError + from cornice.validators._marshmallow import _message_normalizer + parsed = _message_normalizer(ValidationError("Test message", field_names=["test"])) self.assertEqual({"test": ["Test message"]}, parsed) diff --git a/tests/validationapp.py b/tests/validationapp.py index 94d24b18..e3abfc80 100644 --- a/tests/validationapp.py +++ b/tests/validationapp.py @@ -3,10 +3,11 @@ # You can obtain one at http://mozilla.org/MPL/2.0/. import json -from cornice import Service from pyramid.config import Configurator from pyramid.httpexceptions import HTTPBadRequest +from cornice import Service + from .support import CatchErrors @@ -159,6 +160,7 @@ def post7(request): drop, null, ) + from cornice.validators import colander_body_validator, colander_validator COLANDER = True