Spaces:
Sleeping
Sleeping
File size: 1,383 Bytes
64d7fdf c4a4657 64d7fdf c4a4657 64d7fdf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import pytest
import asyncio
import os
from unittest.mock import patch
from httpx import AsyncClient
os.environ.setdefault("GROQ_API_KEY", "test-key-12345")
os.environ.setdefault("JWT_SECRET_KEY", "test-secret-key-67890")
os.environ.setdefault("MONGODB_URI", "mongodb://localhost:27017/test")
os.environ.setdefault("REDIS_URL", "redis://localhost:6379/0")
os.environ.setdefault("QDRANT_URL", "http://localhost:6333")
os.environ.setdefault("QDRANT_API_KEY", "test-qdrant-key")
from app.main import app
from app.db.redis_client import redis_client
from app.db.mongodb import mongodb
from app.core.cache import semantic_cache
@pytest.fixture(scope="session")
def event_loop():
loop = asyncio.get_event_loop_policy().new_event_loop()
yield loop
loop.close()
@pytest.fixture
async def client():
async with AsyncClient(app=app, base_url="http://test") as ac:
yield ac
@pytest.fixture
async def clear_cache():
await semantic_cache.clear()
yield
await semantic_cache.clear()
@pytest.fixture
def sample_query():
return "What is the attention mechanism?"
@pytest.fixture
def sample_document_text():
return """
The attention mechanism is a key component of modern neural networks.
It allows the model to focus on different parts of the input when processing.
This is particularly useful in sequence-to-sequence tasks.
"""
|