Update test_search_db.py

This commit is contained in:
hajdul88 2025-12-11 20:08:47 +01:00
parent 41a3d75ed8
commit 926168b6bd

View file

@ -1,6 +1,7 @@
import pathlib
import os
import pytest
import pytest_asyncio
import cognee
from cognee.infrastructure.databases.graph import get_graph_engine
from cognee.infrastructure.databases.vector import get_vector_engine
@ -23,6 +24,19 @@ from collections import Counter
logger = get_logger()
@pytest_asyncio.fixture(autouse=True)
async def cleanup_litellm_clients():
"""Fixture to properly cleanup LiteLLM async clients after each test."""
yield
# Cleanup LiteLLM async clients to prevent RuntimeWarning about unawaited coroutine
try:
import litellm
if hasattr(litellm, "close_litellm_async_clients"):
await litellm.close_litellm_async_clients()
except Exception:
pass # LiteLLM might not be available or already cleaned up
async def setup_test_environment():
"""Helper function to set up test environment with data, cognify, and triplet embeddings."""
# This test runs for multiple db settings, to run this locally set the corresponding db envs