Remove test since ghostscript error handling changed

This commit is contained in:
James R. Barlow 2025-04-21 12:23:34 -07:00
parent 4143154e91
commit 6851ea7f11
No known key found for this signature in database
GPG Key ID: E54A300D567E1260

View File

@ -398,42 +398,3 @@ def test_prevent_gs_invalid_xml(resources, outdir):
# Ensure we did not carry the nul forward.
assert contents.find(b'�', xmp_start, xmp_end) == -1, "found escaped nul"
assert contents.find(b'\x00', xmp_start, xmp_end) == -1
@pytest.mark.xfail(
ghostscript.version() >= Version('10.01.2'),
reason=(
"Ghostscript now exits with an error on invalid DocumentInfo, defeating "
"this test.",
),
)
def test_malformed_docinfo(caplog, resources, outdir):
generate_pdfa_ps(outdir / 'pdfa.ps')
with pikepdf.open(resources / 'trivial.pdf') as pdf:
pdf.trailer.Info = pikepdf.Stream(pdf, b"<xml></xml>")
pdf.save(outdir / 'layers.rendered.pdf', fix_metadata_version=False)
_, options, _ = get_parser_options_plugins(
args=[
'-j',
'1',
'--output-type',
'pdfa-2',
'a.pdf',
'b.pdf',
]
)
pdfinfo = PdfInfo(outdir / 'layers.rendered.pdf')
context = PdfContext(
options, outdir, outdir / 'layers.rendered.pdf', pdfinfo, get_plugin_manager([])
)
convert_to_pdfa(
str(outdir / 'layers.rendered.pdf'), str(outdir / 'pdfa.ps'), context
)
print(caplog.records)
assert any(
'malformed DocumentInfo block' in record.message for record in caplog.records
)