📝 Fix async test example not to trigger DeprecationWarning (#12084)

This commit is contained in:
Marcin Sulikowski
2024-08-30 18:00:41 +02:00
committed by GitHub
parent 17a29149e4
commit 6e98249c21
5 changed files with 8 additions and 6 deletions

View File

@@ -1,12 +1,14 @@
import pytest
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient
from .main import app
@pytest.mark.anyio
async def test_root():
async with AsyncClient(app=app, base_url="http://test") as ac:
async with AsyncClient(
transport=ASGITransport(app=app), base_url="http://test"
) as ac:
response = await ac.get("/")
assert response.status_code == 200
assert response.json() == {"message": "Tomato"}