with new_event_loop

Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
This commit is contained in:
Daniele Martinoli 2025-03-17 19:32:45 +01:00
parent 55068df475
commit b066f9a83c

View file

@ -4,6 +4,7 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
import asyncio
import os import os
from typing import Any from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch from unittest.mock import AsyncMock, MagicMock, patch
@ -39,7 +40,9 @@ def qdrant_config(tmp_path) -> InlineQdrantVectorIOConfig:
return InlineQdrantVectorIOConfig(path=os.path.join(tmp_path, "qdrant.db")) return InlineQdrantVectorIOConfig(path=os.path.join(tmp_path, "qdrant.db"))
import pytest @pytest.fixture(scope="session")
def loop():
return asyncio.new_event_loop()
@pytest.fixture @pytest.fixture
@ -65,7 +68,7 @@ def mock_api_service(sample_embeddings):
@pytest_asyncio.fixture @pytest_asyncio.fixture
async def qdrant_adapter(qdrant_config, mock_vector_db_store, mock_api_service) -> QdrantVectorIOAdapter: async def qdrant_adapter(qdrant_config, mock_vector_db_store, mock_api_service, loop) -> QdrantVectorIOAdapter:
adapter = QdrantVectorIOAdapter(config=qdrant_config, inference_api=mock_api_service) adapter = QdrantVectorIOAdapter(config=qdrant_config, inference_api=mock_api_service)
adapter.vector_db_store = mock_vector_db_store adapter.vector_db_store = mock_vector_db_store
await adapter.initialize() await adapter.initialize()