Add Route Resolution Benchmarking to Unit Test (#1499)

* feat: add benchmark tester for route resolution and cleanup test warnings

Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>

* feat: refactor sanic benchmark test util into fixtures

Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
This commit is contained in:
Harsha Narayana
2019-02-28 20:26:41 +05:30
committed by Stephen Sadowski
parent 8a59907319
commit 34fe26e51b
11 changed files with 192 additions and 15 deletions

View File

@@ -56,7 +56,7 @@ def test_asyncio_server_start_serving(app):
def test_app_loop_not_running(app):
with pytest.raises(SanicException) as excinfo:
app.loop
_ = app.loop
assert str(excinfo.value) == (
"Loop can only be retrieved after the app has started "
@@ -140,7 +140,6 @@ def test_handle_request_with_nested_exception(app, monkeypatch):
@app.get("/")
def handler(request):
raise Exception
return text("OK")
request, response = app.test_client.get("/")
assert response.status == 500
@@ -162,7 +161,6 @@ def test_handle_request_with_nested_exception_debug(app, monkeypatch):
@app.get("/")
def handler(request):
raise Exception
return text("OK")
request, response = app.test_client.get("/", debug=True)
assert response.status == 500
@@ -186,7 +184,6 @@ def test_handle_request_with_nested_sanic_exception(app, monkeypatch, caplog):
@app.get("/")
def handler(request):
raise Exception
return text("OK")
with caplog.at_level(logging.ERROR):
request, response = app.test_client.get("/")