Resolve Windows errors with -dPDFSTOPONERROR

This commit is contained in:
James R. Barlow
2023-06-02 02:48:38 -07:00
parent 0a7b60cda5
commit 05ecb6ca46
4 changed files with 13 additions and 3 deletions
+4
View File
@@ -196,6 +196,10 @@ def generate_pdfa(
# https://bugs.ghostscript.com/show_bug.cgi?id=705187
compression_args.append('-dNEWPDF=false')
if os.name == 'nt':
# Windows has lots of fatal "permission denied" errors
stop_on_error = False
# nb no need to specify ProcessColorModel when ColorConversionStrategy
# is set; see:
# https://bugs.ghostscript.com/show_bug.cgi?id=699392
+3 -2
View File
@@ -17,6 +17,7 @@ from ocrmypdf import helpers
from .conftest import running_in_docker
needs_symlink = pytest.mark.skipif(os.name == 'nt', reason='needs posix symlink')
windows_only = pytest.mark.skipif(os.name != 'nt', reason="Windows test")
class TestSafeSymlink:
@@ -93,7 +94,7 @@ class TestFileIsWritable:
assert not helpers.is_file_writable(pathmock)
@pytest.mark.skipif(os.name != 'nt', reason="Windows test")
@windows_only
def test_gs_install_locations():
# pylint: disable=import-outside-toplevel
from ocrmypdf.subprocess._windows import _gs_version_in_path_key
@@ -104,7 +105,7 @@ def test_gs_install_locations():
)
@pytest.mark.skipif(os.name != 'nt', reason="Windows test")
@windows_only
def test_shim_paths(tmp_path):
# pylint: disable=import-outside-toplevel
from ocrmypdf.subprocess._windows import shim_env_path
+1 -1
View File
@@ -353,7 +353,7 @@ def test_malformed_docinfo(caplog, resources, outdir):
args=[
'-j',
'1',
'--continue-on-soft-error',
'--continue-on-soft-render-error',
'--output-type',
'pdfa-2',
'a.pdf',
+5
View File
@@ -3,6 +3,10 @@
from __future__ import annotations
import os
import pytest
from ocrmypdf.exceptions import ExitCode
from .conftest import run_ocrmypdf
@@ -46,6 +50,7 @@ def test_render_continue_on_soft_error(resources, outpdf):
assert p.returncode == ExitCode.ok
@pytest.mark.skipif(os.name == 'nt', reason='Ghostscript on Windows errors out')
def test_render_stop_on_soft_error(resources, outpdf):
p = run_ocrmypdf(
resources / 'francais.pdf',