Skip to content
Myr

Run ASGI tests on trio too (#1020)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Florimond Manca · committed by GitHub · parent 3196be9 · Browse files · 1 file+7 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−6 removed

  • tests:+7 added−6 removed

1 file+7 added−6 removed

modified:tests/test_asgi.py+7 added-6 removed
39 unmodified lines
40 await send({"type": "http.response.body", "body": output})41 raise ValueError()424344@pytest.mark.asyncio44@pytest.mark.usefixtures("async_environment")45async def test_asgi():46 client = httpx.AsyncClient(app=hello_world)47 response = await client.get("http://www.example.org/")48 assert response.status_code == 20049 assert response.text == "Hello, World!"505152@pytest.mark.asyncio52@pytest.mark.usefixtures("async_environment")53async def test_asgi_upload():54 client = httpx.AsyncClient(app=echo_body)55 response = await client.post("http://www.example.org/", data=b"example")56 assert response.status_code == 20057 assert response.text == "example"585960@pytest.mark.asyncio60@pytest.mark.usefixtures("async_environment")61async def test_asgi_exc():62 client = httpx.AsyncClient(app=raise_exc)63 with pytest.raises(ValueError):64 await client.get("http://www.example.org/")656667@pytest.mark.asyncio67@pytest.mark.usefixtures("async_environment")68async def test_asgi_http_error():69 client = httpx.AsyncClient(app=partial(raise_exc, exc=httpx.HTTPError))70 with pytest.raises(httpx.HTTPError):71 await client.get("http://www.example.org/")727374@pytest.mark.asyncio74@pytest.mark.usefixtures("async_environment")75async def test_asgi_exc_after_response():76 client = httpx.AsyncClient(app=raise_exc_after_response)77 with pytest.raises(ValueError):78 await client.get("http://www.example.org/")798081@pytest.mark.usefixtures("async_environment")81async def test_asgi_disconnect_after_response_complete(async_environment):82async def test_asgi_disconnect_after_response_complete():83 disconnect = False8485 async def read_body(scope, receive, send):86 nonlocal disconnect
25 unmodified lines