from httpx import AsyncClient, ASGITransport from src.pipeline.main import app from src.pipeline.utils import logger from src.pipeline.core import llm import pytest import pytest_asyncio @pytest_asyncio.fixture(scope="session") async def init_llm(): logger.debug('init_llm') await llm.init_client() yield await llm.close_client() @pytest_asyncio.fixture(scope="session") async def app_client(): transport = ASGITransport(app=app) async with AsyncClient(transport=transport, base_url="http://test") as client: yield client @pytest.mark.asyncio async def test_stream_chat(app_client, init_llm): res = await app_client.post("/api/v1/rag/stream-chat", json={"query": "hello"}) assert res.status_code == 200