From 3dc68778fc1da46371caf600129707119388ab94 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 30 Jun 2026 01:19:00 -0700 Subject: [PATCH] Fix stale auto-mode comment and harden GS-raises test --- src/ocrmypdf/_pipelines/_common.py | 2 +- tests/test_pdfa.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ocrmypdf/_pipelines/_common.py b/src/ocrmypdf/_pipelines/_common.py index 464e2ffb..37e10ebb 100644 --- a/src/ocrmypdf/_pipelines/_common.py +++ b/src/ocrmypdf/_pipelines/_common.py @@ -489,7 +489,7 @@ def postprocess( else: pdf_out = pdf_file if context.options.output_type == 'auto': - # Best effort PDF/A - never uses Ghostscript + # Best effort PDF/A - may use Ghostscript as a last resort pdf_out, actual_type = try_auto_pdfa(pdf_out, context) # Store actual output type for reporting context.options.extra_attrs['_actual_output_type'] = actual_type diff --git a/tests/test_pdfa.py b/tests/test_pdfa.py index 055d14fc..e5ee6ccb 100644 --- a/tests/test_pdfa.py +++ b/tests/test_pdfa.py @@ -205,6 +205,7 @@ def test_auto_degrades_when_ghostscript_raises(resources, outpdf, monkeypatch): from ocrmypdf.exceptions import ColorConversionNeededError monkeypatch.setattr('ocrmypdf._exec.verapdf.available', lambda: False) + monkeypatch.setattr('ocrmypdf._exec.ghostscript.available', lambda: True) def boom(*args, **kwargs): raise ColorConversionNeededError() @@ -219,6 +220,7 @@ def test_auto_degrades_when_ghostscript_raises(resources, outpdf, monkeypatch): 'auto', ) assert exitcode == ExitCode.ok + assert outpdf.exists() assert not file_claims_pdfa(outpdf)['pass']