From: Florimond Manca Date: Sat, 13 Jun 2020 17:42:36 +0000 (+0200) Subject: Run ASGI tests on trio too (#1020) X-Git-Tag: 0.14.0~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=838f417ce0245e843f7147fb7ba1d30e5418b1a3;p=thirdparty%2Fhttpx.git Run ASGI tests on trio too (#1020) --- diff --git a/tests/test_asgi.py b/tests/test_asgi.py index 9d68041a..3584b975 100644 --- a/tests/test_asgi.py +++ b/tests/test_asgi.py @@ -41,7 +41,7 @@ async def raise_exc_after_response(scope, receive, send): raise ValueError() -@pytest.mark.asyncio +@pytest.mark.usefixtures("async_environment") async def test_asgi(): client = httpx.AsyncClient(app=hello_world) response = await client.get("http://www.example.org/") @@ -49,7 +49,7 @@ async def test_asgi(): assert response.text == "Hello, World!" -@pytest.mark.asyncio +@pytest.mark.usefixtures("async_environment") async def test_asgi_upload(): client = httpx.AsyncClient(app=echo_body) response = await client.post("http://www.example.org/", data=b"example") @@ -57,28 +57,29 @@ async def test_asgi_upload(): assert response.text == "example" -@pytest.mark.asyncio +@pytest.mark.usefixtures("async_environment") async def test_asgi_exc(): client = httpx.AsyncClient(app=raise_exc) with pytest.raises(ValueError): await client.get("http://www.example.org/") -@pytest.mark.asyncio +@pytest.mark.usefixtures("async_environment") async def test_asgi_http_error(): client = httpx.AsyncClient(app=partial(raise_exc, exc=httpx.HTTPError)) with pytest.raises(httpx.HTTPError): await client.get("http://www.example.org/") -@pytest.mark.asyncio +@pytest.mark.usefixtures("async_environment") async def test_asgi_exc_after_response(): client = httpx.AsyncClient(app=raise_exc_after_response) with pytest.raises(ValueError): await client.get("http://www.example.org/") -async def test_asgi_disconnect_after_response_complete(async_environment): +@pytest.mark.usefixtures("async_environment") +async def test_asgi_disconnect_after_response_complete(): disconnect = False async def read_body(scope, receive, send):