This commit is contained in:
Adam Hopkins 2021-02-15 14:01:32 +02:00
parent 5377a6eee3
commit 55a5ab4be1
7 changed files with 14 additions and 13 deletions

View File

@ -63,7 +63,7 @@ ifdef include_tests
isort -rc sanic tests isort -rc sanic tests
else else
$(info Sorting Imports) $(info Sorting Imports)
isort -rc sanic tests isort -rc sanic tests --profile=black
endif endif
endif endif
@ -71,7 +71,7 @@ black:
black --config ./.black.toml sanic tests black --config ./.black.toml sanic tests
fix-import: black fix-import: black
isort sanic tests isort sanic tests --profile=black
docs-clean: docs-clean:

View File

@ -14,8 +14,8 @@ from traceback import format_exc
from typing import Any, Dict, Iterable, List, Optional, Set, Type, Union from typing import Any, Dict, Iterable, List, Optional, Set, Type, Union
from urllib.parse import urlencode, urlunparse from urllib.parse import urlencode, urlunparse
from sanic_routing.exceptions import FinalizationError from sanic_routing.exceptions import FinalizationError # type: ignore
from sanic_routing.route import Route from sanic_routing.route import Route # type: ignore
from sanic import reloader_helpers from sanic import reloader_helpers
from sanic.asgi import ASGIApp from sanic.asgi import ASGIApp

View File

@ -2,7 +2,7 @@ from inspect import signature
from pathlib import PurePath from pathlib import PurePath
from typing import Set, Union from typing import Set, Union
from sanic_routing.route import Route from sanic_routing.route import Route # type: ignore
from sanic.constants import HTTP_METHODS from sanic.constants import HTTP_METHODS
from sanic.models.futures import FutureRoute, FutureStatic from sanic.models.futures import FutureRoute, FutureStatic

View File

@ -1,10 +1,12 @@
from functools import lru_cache from functools import lru_cache
from typing import Iterable, List, Optional, Union from typing import Iterable, List, Optional, Union
from sanic_routing import BaseRouter from sanic_routing import BaseRouter # type: ignore
from sanic_routing.exceptions import NoMethod from sanic_routing.exceptions import NoMethod # type: ignore
from sanic_routing.exceptions import NotFound as RoutingNotFound from sanic_routing.exceptions import (
from sanic_routing.route import Route NotFound as RoutingNotFound, # type: ignore
)
from sanic_routing.route import Route # type: ignore
from sanic.constants import HTTP_METHODS from sanic.constants import HTTP_METHODS
from sanic.exceptions import MethodNotSupported, NotFound from sanic.exceptions import MethodNotSupported, NotFound

View File

@ -7,11 +7,9 @@ from json import loads as json_loads
from urllib.parse import urlparse from urllib.parse import urlparse
import pytest import pytest
import ujson
from sanic_testing.testing import ( from sanic_testing.testing import (
ASGI_BASE_URL, ASGI_BASE_URL,
ASGI_HOST,
ASGI_PORT, ASGI_PORT,
HOST, HOST,
PORT, PORT,

View File

@ -161,9 +161,10 @@ def test_matching(path, headers, expected):
request = Request(path, headers, None, "GET", None, app) request = Request(path, headers, None, "GET", None, app)
try: try:
app.router.get(request=request)
except NotFound: except NotFound:
response = 404 response = 404
except Exception as e: except Exception:
response = 500 response = 500
else: else:
response = 200 response = 200

View File

@ -35,7 +35,7 @@ deps =
commands = commands =
flake8 sanic flake8 sanic
black --config ./.black.toml --check --verbose sanic/ black --config ./.black.toml --check --verbose sanic/
isort --check-only sanic isort --check-only sanic --profile=black
[testenv:type-checking] [testenv:type-checking]
deps = deps =