Add support for Trio via AnyIO (#3372)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Thomas Grainger
2021-10-06 16:32:11 +01:00
committed by GitHub
parent 4d26fa5c54
commit 11d0a08acd
15 changed files with 49 additions and 167 deletions

View File

@@ -3,6 +3,6 @@ import pytest
from docs_src.async_tests.test_main import test_root
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_async_testing():
await test_root()

View File

@@ -72,9 +72,15 @@ def test_websocket_with_header_and_query():
def test_websocket_no_credentials():
with pytest.raises(WebSocketDisconnect):
client.websocket_connect("/items/foo/ws")
with client.websocket_connect("/items/foo/ws"):
pytest.fail(
"did not raise WebSocketDisconnect on __enter__"
) # pragma: no cover
def test_websocket_invalid_data():
with pytest.raises(WebSocketDisconnect):
client.websocket_connect("/items/foo/ws?q=bar&token=some-token")
with client.websocket_connect("/items/foo/ws?q=bar&token=some-token"):
pytest.fail(
"did not raise WebSocketDisconnect on __enter__"
) # pragma: no cover