-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
timeout argument doesn't work
server.py
import asyncio
from fastapi import FastAPI
app = FastAPI()
@app.get("/slow_response")
async def slow_request():
await asyncio.sleep(10)test.py
@pytest.mark.anyio
async def test_timeout_exception(app):
async with httpx.AsyncClient(app=app, base_url="https://example.com", timeout=1) as client:
await client.get("/slow_response", timeout=1)$ time pytest tests/test_downloader.py::test_timeout_exception
. [100%]
1 passed in 10.11s
pytest tests/test_downloader.py::test_timeout_exception -q 0.58s user 0.07s system 6% cpu 10.665 totalHow this works? The request takes 10 seconds but it works fine with 1 second timeout
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels