Results of 1 - 1 of about 1 for transport (0.000 sec.)
- Async Tests 9414
- Async Tests Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You have already seen how to test your FastAPI applications using the provided TestClient . Up to now,
...st_main.py would have the tests for main.py , it could look like this now: Python 3.8+ import pytest from httpx import ASGITransport , AsyncClient from .main import app @pytest . mark . anyio async def test_root (): async with AsyncClient ( transport = AS...GITransport ( app = app ), base_url = "http://test" ) as ac : response = await ac . get ( "/" ) assert response . status_code == 200 a...nyio tells pytest that this test function should be called asynchronously: Python 3.8+ import pytest from httpx import ASGITransport , AsyncClient from .main import app @pytest . mark . anyio async def test_root (): async with AsyncClient ( transport = AS... - https://man.mtool.work/fastapi/0.115/advanced/async-tests/
PREV
1
NEXT