mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2026-05-04 12:48:02 -04:00
tests: account for test that expected pngquant for windows
This commit is contained in:
@@ -4,23 +4,31 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import os
|
||||
|
||||
import pikepdf
|
||||
import pytest
|
||||
|
||||
from ocrmypdf.exceptions import MissingDependencyError
|
||||
|
||||
from .conftest import check_ocrmypdf
|
||||
|
||||
|
||||
@pytest.mark.parametrize('optimize', (0, 3))
|
||||
@pytest.mark.parametrize('pdfa_level', (1, 2, 3))
|
||||
def test_pdfa(resources, outpdf, optimize, pdfa_level):
|
||||
check_ocrmypdf(
|
||||
resources / 'francais.pdf',
|
||||
outpdf,
|
||||
'--plugin',
|
||||
'tests/plugins/tesseract_noop.py',
|
||||
f'--output-type=pdfa-{pdfa_level}',
|
||||
f'--optimize={optimize}',
|
||||
)
|
||||
try:
|
||||
check_ocrmypdf(
|
||||
resources / 'francais.pdf',
|
||||
outpdf,
|
||||
'--plugin',
|
||||
'tests/plugins/tesseract_noop.py',
|
||||
f'--output-type=pdfa-{pdfa_level}',
|
||||
f'--optimize={optimize}',
|
||||
)
|
||||
except MissingDependencyError as e:
|
||||
if 'pngquant' in str(e) and optimize in (2, 3) and os.name == 'nt':
|
||||
pytest.xfail("pngquant currently not available on Windows")
|
||||
if pdfa_level in (2, 3):
|
||||
# PDF/A-2 allows ObjStm
|
||||
assert b'/ObjStm' in outpdf.read_bytes()
|
||||
|
||||
Reference in New Issue
Block a user