From 8defa11c4784b6e1a1c1a745b022b95c6956378c Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 12 Dec 2020 15:17:41 +0100 Subject: [PATCH] Make tests fail when an error is reported by GhostScript --- tests/conftest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 21761dd5..634f73c7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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: