Skip to content

testing: OCR tests never run in CI — paddleocr isn't in the dev group #397

Description

@Abhash-Chakraborty

Problem

backend/tests/test_ocr.py and backend/tests/test_ocr_variants.py both open with:

pytest.importorskip("paddleocr")
pytest.importorskip("paddle")

paddleocr and paddlepaddle live in the cpu and nvidia optional-dependency extras, not in [dependency-groups].dev. backend-check runs uv sync --group dev --locked, so neither is installed and every OCR test skips on every run.

The skips are silent — pytest -q reports them in the same summary line as any other skip, so the suite looks green while a whole module is inert.

Surfaced while reviewing #364, which adds 177 lines of variant-selection and fallback tests that will never execute as things stand. Not that PR's fault; the gap predates it.

Options

a. Add paddleocr + paddlepaddle to the dev group. Simplest, and the tests then run for real. Costs install time and image size on every backend-check — paddlepaddle is a heavy wheel, so this needs measuring before committing to it.

b. Add a separate CI job that syncs the cpu extra and runs only the ML-tagged tests, gated on backend/src/find_api/ml/** changes. Keeps the main job fast and only pays the cost when ML code moves.

c. Mock the paddle import surface so the variant-selection logic (which is pure Python — PP_OCR_MODELS, _normalize_variant, cache keys, status publishing) is testable without the real package, and keep importorskip for the tests that genuinely need inference.

(b) or (c) look right; (c) covers most of what #364's tests actually assert, since very little of it needs a real model.

Also worth checking

Whether any other module has the same problem — grep -rn importorskip backend/tests/ is the quick version. If a test can be skipped into irrelevance without anyone noticing, it isn't providing the coverage it looks like it is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciContinuous integration and automationmlModel inference, embeddings, OCR, captions, and search relevanceneeds triageNeeds maintainer classificationpriority: mediumUseful issue with moderate urgencytestingAutomated tests or manual QA coverage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions