upgrade pytest version that compatible with pytest-cov, fixes some caplog unit tests (#1464)
This commit is contained in:
parent
96af1fe7cf
commit
8dd8e9916e
2
setup.py
2
setup.py
|
@ -86,7 +86,7 @@ requirements = [
|
||||||
]
|
]
|
||||||
|
|
||||||
tests_require = [
|
tests_require = [
|
||||||
"pytest==3.3.2",
|
"pytest==4.1.0",
|
||||||
"multidict>=4.0,<5.0",
|
"multidict>=4.0,<5.0",
|
||||||
"gunicorn",
|
"gunicorn",
|
||||||
"pytest-cov",
|
"pytest-cov",
|
||||||
|
|
|
@ -155,8 +155,8 @@ def test_handle_request_with_nested_sanic_exception(app, monkeypatch, caplog):
|
||||||
request, response = app.test_client.get("/")
|
request, response = app.test_client.get("/")
|
||||||
assert response.status == 500
|
assert response.status == 500
|
||||||
assert response.text == "Error: Mock SanicException"
|
assert response.text == "Error: Mock SanicException"
|
||||||
assert caplog.record_tuples[0] == (
|
assert (
|
||||||
"sanic.root",
|
"sanic.root",
|
||||||
logging.ERROR,
|
logging.ERROR,
|
||||||
"Exception occurred while handling uri: 'http://127.0.0.1:42101/'",
|
"Exception occurred while handling uri: 'http://127.0.0.1:42101/'",
|
||||||
)
|
) in caplog.record_tuples
|
||||||
|
|
|
@ -161,7 +161,7 @@ class ReuseableSanicTestClient(SanicTestClient):
|
||||||
conn = self._tcp_connector
|
conn = self._tcp_connector
|
||||||
else:
|
else:
|
||||||
conn = ReuseableTCPConnector(
|
conn = ReuseableTCPConnector(
|
||||||
verify_ssl=False,
|
ssl=False,
|
||||||
loop=self._loop,
|
loop=self._loop,
|
||||||
keepalive_timeout=request_keepalive,
|
keepalive_timeout=request_keepalive,
|
||||||
)
|
)
|
||||||
|
|
|
@ -86,12 +86,12 @@ def test_middleware_response_raise_cancelled_error(app, caplog):
|
||||||
with caplog.at_level(logging.ERROR):
|
with caplog.at_level(logging.ERROR):
|
||||||
reqrequest, response = app.test_client.get("/")
|
reqrequest, response = app.test_client.get("/")
|
||||||
|
|
||||||
assert response.status == 503
|
assert response.status == 503
|
||||||
assert caplog.record_tuples[0] == (
|
assert (
|
||||||
"sanic.root",
|
"sanic.root",
|
||||||
logging.ERROR,
|
logging.ERROR,
|
||||||
"Exception occurred while handling uri: 'http://127.0.0.1:42101/'",
|
"Exception occurred while handling uri: 'http://127.0.0.1:42101/'",
|
||||||
)
|
) in caplog.record_tuples
|
||||||
|
|
||||||
|
|
||||||
def test_middleware_response_raise_exception(app, caplog):
|
def test_middleware_response_raise_exception(app, caplog):
|
||||||
|
@ -103,16 +103,16 @@ def test_middleware_response_raise_exception(app, caplog):
|
||||||
reqrequest, response = app.test_client.get("/")
|
reqrequest, response = app.test_client.get("/")
|
||||||
|
|
||||||
assert response.status == 404
|
assert response.status == 404
|
||||||
assert caplog.record_tuples[0] == (
|
assert (
|
||||||
"sanic.root",
|
"sanic.root",
|
||||||
logging.ERROR,
|
logging.ERROR,
|
||||||
"Exception occurred while handling uri: 'http://127.0.0.1:42101/'",
|
"Exception occurred while handling uri: 'http://127.0.0.1:42101/'",
|
||||||
)
|
) in caplog.record_tuples
|
||||||
assert caplog.record_tuples[1] == (
|
assert (
|
||||||
"sanic.error",
|
"sanic.error",
|
||||||
logging.ERROR,
|
logging.ERROR,
|
||||||
"Exception occurred in one of response middleware handlers",
|
"Exception occurred in one of response middleware handlers",
|
||||||
)
|
) in caplog.record_tuples
|
||||||
|
|
||||||
|
|
||||||
def test_middleware_override_request(app):
|
def test_middleware_override_request(app):
|
||||||
|
|
|
@ -152,7 +152,7 @@ class DelayableSanicTestClient(SanicTestClient):
|
||||||
)
|
)
|
||||||
conn = DelayableTCPConnector(
|
conn = DelayableTCPConnector(
|
||||||
pre_request_delay=self._request_delay,
|
pre_request_delay=self._request_delay,
|
||||||
verify_ssl=False,
|
ssl=False,
|
||||||
loop=self._loop,
|
loop=self._loop,
|
||||||
)
|
)
|
||||||
async with aiohttp.ClientSession(
|
async with aiohttp.ClientSession(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user