From 4c5b72dab02a7dc9590ab4e760acd3764094fea8 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sun, 4 Jul 2021 23:07:13 +0200 Subject: [PATCH] src/img2pdf_test.py: skip tests when icc profiles are not present --- src/img2pdf_test.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/img2pdf_test.py b/src/img2pdf_test.py index d5be82d..bdb8c7d 100755 --- a/src/img2pdf_test.py +++ b/src/img2pdf_test.py @@ -304,7 +304,11 @@ def compare(im1, im2, exact, icc, cmyk): else: iccargs = [] if icc: - iccargs = ["-profile", "/usr/share/color/icc/sRGB.icc"] + profile = "/usr/share/color/icc/sRGB.icc" + if not os.path.isfile(profile): + warnings.warn(profile + " not present, skipping checks...") + return + iccargs = ["-profile", profile] psnr = subprocess.run( ["compare"] + iccargs @@ -417,6 +421,10 @@ def compare_pdfimages_png(tmpdir, img, pdf, exact=True, icc=False): ) else: if icc: + profile = "/usr/share/color/icc/ghostscript/srgb.icc" + if not os.path.isfile(profile): + warnings.warn(profile + " not present, skipping checks...") + return psnr = subprocess.run( [ "compare", @@ -424,7 +432,7 @@ def compare_pdfimages_png(tmpdir, img, pdf, exact=True, icc=False): "PSNR", "(", "-profile", - "/usr/share/color/icc/ghostscript/srgb.icc", + profile, "-depth", "8", str(img),