squash
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from inspect import isawaitable
|
||||
|
||||
import pytest
|
||||
@@ -29,7 +30,9 @@ def test_app_loop_running(app):
|
||||
assert response.text == "pass"
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
|
||||
@pytest.mark.skipif(
|
||||
sys.version_info < (3, 7), reason="requires python3.7 or higher"
|
||||
)
|
||||
def test_create_asyncio_server(app):
|
||||
if not uvloop_installed():
|
||||
loop = asyncio.get_event_loop()
|
||||
@@ -39,7 +42,9 @@ def test_create_asyncio_server(app):
|
||||
assert srv.is_serving() is True
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
|
||||
@pytest.mark.skipif(
|
||||
sys.version_info < (3, 7), reason="requires python3.7 or higher"
|
||||
)
|
||||
def test_asyncio_server_no_start_serving(app):
|
||||
if not uvloop_installed():
|
||||
loop = asyncio.get_event_loop()
|
||||
@@ -52,7 +57,9 @@ def test_asyncio_server_no_start_serving(app):
|
||||
assert srv.is_serving() is False
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
|
||||
@pytest.mark.skipif(
|
||||
sys.version_info < (3, 7), reason="requires python3.7 or higher"
|
||||
)
|
||||
def test_asyncio_server_start_serving(app):
|
||||
if not uvloop_installed():
|
||||
loop = asyncio.get_event_loop()
|
||||
@@ -149,7 +156,9 @@ def test_handle_request_with_nested_exception(app, monkeypatch):
|
||||
def mock_error_handler_response(*args, **kwargs):
|
||||
raise Exception(err_msg)
|
||||
|
||||
monkeypatch.setattr(app.error_handler, "response", mock_error_handler_response)
|
||||
monkeypatch.setattr(
|
||||
app.error_handler, "response", mock_error_handler_response
|
||||
)
|
||||
|
||||
@app.get("/")
|
||||
def handler(request):
|
||||
@@ -168,7 +177,9 @@ def test_handle_request_with_nested_exception_debug(app, monkeypatch):
|
||||
def mock_error_handler_response(*args, **kwargs):
|
||||
raise Exception(err_msg)
|
||||
|
||||
monkeypatch.setattr(app.error_handler, "response", mock_error_handler_response)
|
||||
monkeypatch.setattr(
|
||||
app.error_handler, "response", mock_error_handler_response
|
||||
)
|
||||
|
||||
@app.get("/")
|
||||
def handler(request):
|
||||
@@ -187,7 +198,9 @@ def test_handle_request_with_nested_sanic_exception(app, monkeypatch, caplog):
|
||||
def mock_error_handler_response(*args, **kwargs):
|
||||
raise SanicException("Mock SanicException")
|
||||
|
||||
monkeypatch.setattr(app.error_handler, "response", mock_error_handler_response)
|
||||
monkeypatch.setattr(
|
||||
app.error_handler, "response", mock_error_handler_response
|
||||
)
|
||||
|
||||
@app.get("/")
|
||||
def handler(request):
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
from collections import deque, namedtuple
|
||||
|
||||
import pytest
|
||||
|
||||
import uvicorn
|
||||
|
||||
from sanic import Sanic
|
||||
from sanic.asgi import MockTransport
|
||||
from sanic.exceptions import InvalidUsage
|
||||
|
||||
Reference in New Issue
Block a user