From 1c82a803891bd4b4b70d03ed9d45f855e0dc22f7 Mon Sep 17 00:00:00 2001 From: Pier-Jean Malandrino Date: Fri, 3 Apr 2026 15:46:29 +0200 Subject: [PATCH] Guard all docling-dependent tests for lightweight CI local_converter imports docling at module level, so any test that touches it crashes when docling is not installed. Skip those tests with importorskip / skipif so the CI (which only has docling-core) passes cleanly. --- document-parser/tests/test_serve_converter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/document-parser/tests/test_serve_converter.py b/document-parser/tests/test_serve_converter.py index 6b0b9cb..58c5ecf 100644 --- a/document-parser/tests/test_serve_converter.py +++ b/document-parser/tests/test_serve_converter.py @@ -2,6 +2,7 @@ from __future__ import annotations +import importlib import json from unittest.mock import AsyncMock, MagicMock, patch @@ -16,6 +17,12 @@ from infra.serve_converter import ( _parse_response, ) + +def _has_docling() -> bool: + """Return True if the heavy docling library is available.""" + return importlib.util.find_spec("docling") is not None + + # --------------------------------------------------------------------------- # Unit tests — form data building # --------------------------------------------------------------------------- @@ -452,6 +459,10 @@ class TestServeConverterConvert: class TestConverterWiring: + @pytest.mark.skipif( + not _has_docling(), + reason="docling library not installed", + ) def test_local_engine_builds_local_converter(self): from infra.local_converter import LocalConverter from infra.settings import Settings