Update test_search_db.py
This commit is contained in:
parent
41a3d75ed8
commit
926168b6bd
1 changed files with 14 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import pathlib
|
import pathlib
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
import pytest_asyncio
|
||||||
import cognee
|
import cognee
|
||||||
from cognee.infrastructure.databases.graph import get_graph_engine
|
from cognee.infrastructure.databases.graph import get_graph_engine
|
||||||
from cognee.infrastructure.databases.vector import get_vector_engine
|
from cognee.infrastructure.databases.vector import get_vector_engine
|
||||||
|
|
@ -23,6 +24,19 @@ from collections import Counter
|
||||||
logger = get_logger()
|
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():
|
async def setup_test_environment():
|
||||||
"""Helper function to set up test environment with data, cognify, and triplet embeddings."""
|
"""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
|
# This test runs for multiple db settings, to run this locally set the corresponding db envs
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue