1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-04 16:07:57 +03:00

Make tests fail when an error is reported by GhostScript

This commit is contained in:
Guillaume Ayoub 2020-12-12 15:17:41 +01:00
parent 85cfc933c6
commit 8defa11c47

View File

@ -29,6 +29,10 @@ def document_write_png(self, target=None, resolution=96, antialiasing=1):
f'-r{resolution}', '-sOutputFile=-', '-']
pngs = run(command, input=pdf, stdout=PIPE).stdout
assert pngs.startswith(MAGIC_NUMBER), (
'GhostScript error: '
f'{pngs.split(MAGIC_NUMBER)[0].decode("ascii").strip()}')
# TODO: use a different way to find PNG files in stream
magic_numbers = pngs.count(MAGIC_NUMBER)
if magic_numbers == 1: