Files
SnapOtter/packages/ai/python/tests/test_ocr_runtime_isolation.py
T

19 lines
660 B
Python
Raw Normal View History

"""Accurate OCR must never re-enter the mutable legacy Python dispatcher."""
from pathlib import Path
from packages.ai.python import dispatcher
def test_legacy_dispatcher_does_not_allow_ocr_scripts():
assert "ocr" not in dispatcher.ALLOWED_SCRIPTS
assert "ocr_pdf" not in dispatcher.ALLOWED_SCRIPTS
def test_shared_requirements_do_not_install_paddle():
python_root = Path(__file__).resolve().parents[1]
for name in ("requirements.txt", "requirements-gpu.txt"):
requirements = (python_root / name).read_text(encoding="utf-8").lower()
assert "paddleocr" not in requirements
assert "paddlepaddle" not in requirements