diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e21a38..3afe1ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,10 +40,13 @@ jobs: run: python -m compileall -q app scripts tests - name: Pytest (unit only — heavy deps excluded) + # test_chunker.py skips here: it needs the pinned document recognition + # engine (private TeamHUB_Engines repo, no PAT secret configured). + # It runs in the Docker image and in dev envs with the engine installed. run: | pytest tests/test_hashing.py tests/test_quality.py \ tests/test_chunker.py tests/test_duplicates.py \ - tests/test_hybrid_search.py -q + tests/test_hybrid_search.py -q -rs - name: docker compose config run: docker compose config --quiet diff --git a/app/ingestion/docling_extractor.py b/app/ingestion/docling_extractor.py index b4afa4d..d5012b1 100644 --- a/app/ingestion/docling_extractor.py +++ b/app/ingestion/docling_extractor.py @@ -15,6 +15,17 @@ from teamhub_document_recognition_engine import extract as _engine_extract from app.config import settings +# Re-exported engine models: chunker, table/figure processors and tests import +# them from this adapter instead of depending on the engine package directly. +__all__ = [ + "ExtractedBlock", + "ExtractedFigure", + "ExtractedPage", + "ExtractedTable", + "ExtractionResult", + "extract", +] + def extract(pdf_path: Path) -> ExtractionResult: return _engine_extract(pdf_path, docling_ocr_enabled=settings.docling_ocr_enabled) diff --git a/tests/test_chunker.py b/tests/test_chunker.py index 9ffc5ef..efa9bc9 100644 --- a/tests/test_chunker.py +++ b/tests/test_chunker.py @@ -1,7 +1,14 @@ from __future__ import annotations -from app.ingestion.chunker import chunk_extraction -from app.ingestion.docling_extractor import ( +import pytest + +# CI installs light deps only; the pinned engine repo is private (no PAT), so +# these tests run wherever the engine is installed (Docker image, dev env) and +# skip visibly elsewhere. See app/ingestion/ENGINE_SOURCE.md. +pytest.importorskip("teamhub_document_recognition_engine") + +from app.ingestion.chunker import chunk_extraction # noqa: E402 +from app.ingestion.docling_extractor import ( # noqa: E402 ExtractedBlock, ExtractedFigure, ExtractedPage, diff --git a/tests/test_document_recognition_engine_adapter.py b/tests/test_document_recognition_engine_adapter.py index 8e10752..c06fc25 100644 --- a/tests/test_document_recognition_engine_adapter.py +++ b/tests/test_document_recognition_engine_adapter.py @@ -1,5 +1,11 @@ from pathlib import Path +import pytest + +# Skip cleanly where the pinned engine is not installed (e.g. light-deps CI); +# see app/ingestion/ENGINE_SOURCE.md for the focused verification command. +pytest.importorskip("teamhub_document_recognition_engine") + def test_legacy_ocr_adapter_reexports_engine_model_and_settings(monkeypatch, tmp_path: Path) -> None: from teamhub_document_recognition_engine import OcrResult as EngineOcrResult @@ -34,6 +40,8 @@ def test_legacy_ocr_adapter_reexports_engine_model_and_settings(monkeypatch, tmp def test_legacy_docling_adapter_reexports_engine_models_and_settings(monkeypatch, tmp_path: Path) -> None: from teamhub_document_recognition_engine import ( ExtractedBlock as EngineExtractedBlock, + ) + from teamhub_document_recognition_engine import ( ExtractionResult as EngineExtractionResult, )