From b94d1c059b02737aa2adba8f468f8817ab7d36f9 Mon Sep 17 00:00:00 2001 From: stumpylog <797416+stumpylog@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:43:23 -0700 Subject: [PATCH] refactor(ai-tests): move vector_store imports to module level in test_ai_indexing Co-Authored-By: Claude Sonnet 4.6 --- src/paperless_ai/tests/test_ai_indexing.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/paperless_ai/tests/test_ai_indexing.py b/src/paperless_ai/tests/test_ai_indexing.py index 5fbb6806d..9084dd99a 100644 --- a/src/paperless_ai/tests/test_ai_indexing.py +++ b/src/paperless_ai/tests/test_ai_indexing.py @@ -17,6 +17,8 @@ from documents.tests.factories import PaperlessTaskFactory from paperless.models import ApplicationConfiguration from paperless_ai import indexing from paperless_ai.tests.conftest import FakeEmbedding +from paperless_ai.vector_store import Migration +from paperless_ai.vector_store import PaperlessLanceVectorStore @pytest.fixture @@ -221,9 +223,6 @@ def test_update_llm_index_applies_structural_migration_without_rebuild( mocker: pytest_mock.MockerFixture, ) -> None: """Structural migrations are applied in-place; no full rebuild (drop) occurs.""" - from paperless_ai.vector_store import Migration - from paperless_ai.vector_store import PaperlessLanceVectorStore - column_added: list[bool] = [] def _add_extra(table) -> None: @@ -268,9 +267,6 @@ def test_update_llm_index_forces_rebuild_on_reembed_migration( mocker: pytest_mock.MockerFixture, ) -> None: """A pending reembed migration causes a full drop+rebuild on next update.""" - from paperless_ai.vector_store import Migration - from paperless_ai.vector_store import PaperlessLanceVectorStore - # Build the initial index at version 1 (the real CURRENT_SCHEMA_VERSION; no patches needed). with patch("documents.models.Document.objects.all") as mock_all: mock_queryset = MagicMock() @@ -771,8 +767,6 @@ class TestLanceDbIndexing: temp_llm_index_dir: Path, mock_embed_model: FakeEmbedding, ) -> None: - from paperless_ai.vector_store import PaperlessLanceVectorStore - store = indexing.get_vector_store() assert isinstance(store, PaperlessLanceVectorStore)