# 兼容旧版系统 sqlite3 (<3.35):chromadb 需要更高版本。 # 仅测试环境生效(conftest 不参与生产加载);若系统已装新版 sqlite3 可移除。 try: import pysqlite3 import sys sys.modules["sqlite3"] = pysqlite3 except ImportError: pass import pytest from httpx import AsyncClient, ASGITransport from app.main import app @pytest.fixture async def client(): transport = ASGITransport(app=app) async with AsyncClient(transport=transport, base_url="http://test") as ac: yield ac @pytest.fixture async def health_response(client): resp = await client.get("/health") return resp