示例#1
0
async def test_app_handle_request_asyncio_cancelled_error() -> None:
    app = Quart(__name__)

    @app.route("/")
    async def index() -> NoReturn:
        raise asyncio.CancelledError()

    request = app.request_class("GET",
                                "http",
                                "/",
                                b"",
                                CIMultiDict(),
                                "",
                                "1.1",
                                send_push_promise=no_op_push)
    with pytest.raises(asyncio.CancelledError):
        await app.handle_request(request)
示例#2
0
async def test_app_handle_request_asyncio_cancelled_error(http_scope: HTTPScope) -> None:
    app = Quart(__name__)

    @app.route("/")
    async def index() -> NoReturn:
        raise asyncio.CancelledError()

    request = app.request_class(
        "GET",
        "http",
        "/",
        b"",
        Headers([("host", "quart.com")]),
        "",
        "1.1",
        http_scope,
        send_push_promise=no_op_push,
    )
    with pytest.raises(asyncio.CancelledError):
        await app.handle_request(request)