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.
This commit is contained in:
Pier-Jean Malandrino 2026-04-03 15:46:29 +02:00
parent 41863152cb
commit 1c82a80389

View file

@ -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