Bakalarska_praca/tests/fixtures/auto_close_qdrant.py
oleh 959a391334
Some checks failed
publish docs / publish-docs (push) Has been cancelled
release-please / release-please (push) Has been cancelled
tests / setup (push) Has been cancelled
tests / ${{ matrix.quality-command }} (black) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (mypy) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (ruff) (push) Has been cancelled
tests / test (push) Has been cancelled
tests / all_checks_passed (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
add self code
2024-09-27 18:52:16 +02:00

19 lines
557 B
Python

import pytest
from private_gpt.components.vector_store.vector_store_component import (
VectorStoreComponent,
)
from tests.fixtures.mock_injector import MockInjector
@pytest.fixture(autouse=True)
def _auto_close_vector_store_client(injector: MockInjector) -> None:
"""Auto close VectorStore client after each test.
VectorStore client (qdrant/chromadb) opens a connection the
Database that causes issues when running tests too fast,
so close explicitly after each test.
"""
yield
injector.get(VectorStoreComponent).close()