Create requests-async based TestClient, remove aiohttp dependency, drop Python 3.5

Update all tests to be compatible with requests-async
Cleanup testing client changes with black and isort
Remove Python 3.5 and other meta doc cleanup
rename pyproject and fix pep517 error
Add black config to tox.ini
Cleanup tests and remove aiohttp
tox.ini change for easier development commands
Remove aiohttp from changelog and requirements
Cleanup imports and Makefile
This commit is contained in:
Adam Hopkins
2019-04-24 00:44:42 +03:00
parent 6a4a3f617f
commit ccd4c9615c
56 changed files with 649 additions and 578 deletions

View File

@@ -1,6 +1,7 @@
import asyncio
import inspect
import os
from collections import namedtuple
from mimetypes import guess_type
from random import choice
@@ -8,6 +9,7 @@ from unittest.mock import MagicMock
from urllib.parse import unquote
import pytest
from aiofiles import os as async_os
from sanic.response import (
@@ -18,11 +20,11 @@ from sanic.response import (
json,
raw,
stream,
text,
)
from sanic.server import HttpProtocol
from sanic.testing import HOST, PORT
JSON_DATA = {"ok": True}
@@ -77,10 +79,10 @@ def test_response_header(app):
request, response = app.test_client.get("/")
assert dict(response.headers) == {
"Connection": "keep-alive",
"Keep-Alive": str(app.config.KEEP_ALIVE_TIMEOUT),
"Content-Length": "11",
"Content-Type": "application/json",
"connection": "keep-alive",
"keep-alive": str(app.config.KEEP_ALIVE_TIMEOUT),
"content-length": "11",
"content-type": "application/json",
}
@@ -276,7 +278,7 @@ def test_stream_response_with_cookies(app):
return response
request, response = app.test_client.get("/")
assert response.cookies["test"].value == "pass"
assert response.cookies["test"] == "pass"
def test_stream_response_without_cookies(app):