Merge branch 'master' of github.com:huge-success/sanic

This commit is contained in:
Adam Hopkins 2020-07-09 14:24:06 +03:00
commit db1c819fe1
8 changed files with 9 additions and 16 deletions

View File

@ -71,7 +71,7 @@ black:
black --config ./.black.toml sanic tests
fix-import: black
isort -rc sanic tests
isort sanic tests
docs-clean:

View File

@ -0,0 +1 @@
Remove [version] section.

View File

@ -14,7 +14,8 @@ class Header(CIMultiDict):
use_trio = argv[0].endswith("hypercorn") and "trio" in argv
if use_trio:
from trio import open_file as open_async, Path # type: ignore
from trio import Path # type: ignore
from trio import open_file as open_async # type: ignore
def stat_async(path):
return Path(path).stat()

View File

@ -14,10 +14,10 @@ from sanic.helpers import has_message_body, remove_entity_headers
try:
from ujson import dumps as json_dumps
except ImportError:
from json import dumps
# This is done in order to ensure that the JSON response is
# kept consistent across both ujson and inbuilt json usage.
from json import dumps
json_dumps = partial(dumps, separators=(",", ":"))

View File

@ -5,7 +5,7 @@ import signal
import sys
import traceback
import gunicorn.workers.base as base # type: ignore
from gunicorn.workers import base as base # type: ignore
from sanic.server import HttpProtocol, Signal, serve, trigger_events
from sanic.websocket import WebSocketProtocol

View File

@ -11,9 +11,3 @@ line_length = 79
lines_after_imports = 2
lines_between_types = 1
multi_line_output = 3
[version]
current_version = 19.12.0
files = sanic/__version__.py
current_version_pattern = __version__ = "{current_version}"
new_version_pattern = __version__ = "{new_version}"

View File

@ -1,7 +1,6 @@
# Run with: gunicorn --workers=1 --worker-class=meinheld.gmeinheld.MeinheldWorker simple_server:main
""" Minimal helloworld application.
"""
import ujson
from wheezy.http import HTTPResponse, WSGIApplication
@ -39,6 +38,7 @@ main = WSGIApplication(
if __name__ == "__main__":
import sys
from wsgiref.simple_server import make_server
try:

View File

@ -1955,10 +1955,7 @@ def test_server_name_and_url_for(app):
app.config.SERVER_NAME = "my-server" # This means default port
assert app.url_for("handler", _external=True) == "http://my-server/foo"
request, response = app.test_client.get("/foo")
assert (
request.url_for("handler")
== f"http://my-server/foo"
)
assert request.url_for("handler") == f"http://my-server/foo"
app.config.SERVER_NAME = "https://my-server/path"
request, response = app.test_client.get("/foo")