fix: Preflight-Check und Exit-Code in --once Modus (v0.2.1)
- #1: check_preflight() prüft beim Start tesseract + gs, wirft PreflightError. CLI endet mit Exit 2 statt grün zu bleiben. - #2: run_once() gibt Anzahl fehlgeschlagener PDFs zurück, CLI endet mit Exit 1 wenn mindestens eine Datei scheiterte. - pytest-Suite mit 11 Tests für beide Szenarien - ocrmypdf-Import lazy in processor.py (Tests ohne ocrmypdf möglich) Closes #1, #2 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,6 @@ import subprocess
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import ocrmypdf
|
||||
|
||||
from .config import OcrConfig, VeraPdfConfig
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -25,6 +23,8 @@ class ProcessResult:
|
||||
|
||||
def run_ocr(src: Path, dst: Path, cfg: OcrConfig) -> None:
|
||||
"""Führt ocrmypdf als Library-Call aus (kein Subprozess-Overhead)."""
|
||||
import ocrmypdf # lazy, damit Tests ohne ocrmypdf laufen
|
||||
|
||||
kwargs: dict = {
|
||||
"language": cfg.languages,
|
||||
"jobs": cfg.jobs,
|
||||
|
||||
Reference in New Issue
Block a user