Files
request-coalescing-py/tests/conftest.py
2023-10-03 22:13:42 +01:00

24 lines
589 B
Python

import pytest
from fastapi import FastAPI
from httpx import AsyncClient
from asgi_lifespan import LifespanManager
from request_coalescing_py.main import app
from request_coalescing_py.models import Item
@pytest.fixture
def anyio_backend() -> str:
return "asyncio"
@pytest.fixture(scope="function")
async def test_app() -> FastAPI:
async with LifespanManager(app) as manager:
yield manager.app
@pytest.fixture(scope="function")
async def client(test_app) -> AsyncClient:
async with AsyncClient(app=test_app, base_url="http://test") as client:
yield client