Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python311Packages.img2pdf: 0.4.4 -> 0.5.0 #264119

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

dotlambda
Copy link
Member

Any idea why four tests are failing?
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.2.0
rootdir: /build/img2pdf-0.5.0
collected 351 items / 18 deselected / 333 selected

src/img2pdf_test.py ......ssssss..........................ss............ [ 15%]
......................................FFFF.............................. [ 37%]
........................................................................ [ 58%]
........................................................................ [ 80%]
.........ssssssss................................................        [100%]

=================================== FAILURES ===================================
__________________________ test_miff_cmyk8[internal] ___________________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685e0d0>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk80/in.miff')
tiff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff')
miff_cmyk8_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk8_pdf0/out.pdf')

    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk8(tmp_path_factory, miff_cmyk8_img, tiff_cmyk8_img, miff_cmyk8_pdf):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk8")
>       compare_ghostscript(
            tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc", exact=False
        )

src/img2pdf_test.py:6406:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk81/gs-1.tiff', exact = False
icc = False, cmyk = False

    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
>           assert psnr != b"0 (0)"
E           AssertionError: assert b'0 (0)' != b'0 (0)'

src/img2pdf_test.py:391: AssertionError
___________________________ test_miff_cmyk8[pikepdf] ___________________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685e0d0>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk80/in.miff')
tiff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff')
miff_cmyk8_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk8_pdf1/out.pdf')

    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk8(tmp_path_factory, miff_cmyk8_img, tiff_cmyk8_img, miff_cmyk8_pdf):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk8")
>       compare_ghostscript(
            tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc", exact=False
        )

src/img2pdf_test.py:6406:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk82/gs-1.tiff', exact = False
icc = False, cmyk = False

    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
>           assert psnr != b"0 (0)"
E           AssertionError: assert b'0 (0)' != b'0 (0)'

src/img2pdf_test.py:391: AssertionError
__________________________ test_miff_cmyk16[internal] __________________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685e0d0>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk160/in.miff')
tiff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff')
miff_cmyk16_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk16_pdf0/out.pdf')

    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk16(
        tmp_path_factory, miff_cmyk16_img, tiff_cmyk16_img, miff_cmyk16_pdf
    ):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk16")
>       compare_ghostscript(
            tmpdir, tiff_cmyk16_img, miff_cmyk16_pdf, gsdevice="tiff32nc", exact=False
        )

src/img2pdf_test.py:6422:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk161/gs-1.tiff', exact = False
icc = False, cmyk = False

    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
            assert psnr != b"0 (0)"
            assert psnr_re.fullmatch(psnr) is not None, psnr
            psnr = psnr_re.fullmatch(psnr).group(1)
            psnr = float(psnr)
            assert psnr != 0  # or otherwise we would use the exact variant
>           assert psnr > 50
E           assert 6.35075 > 50

src/img2pdf_test.py:396: AssertionError
__________________________ test_miff_cmyk16[pikepdf] ___________________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685e0d0>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk160/in.miff')
tiff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff')
miff_cmyk16_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk16_pdf1/out.pdf')

    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk16(
        tmp_path_factory, miff_cmyk16_img, tiff_cmyk16_img, miff_cmyk16_pdf
    ):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk16")
>       compare_ghostscript(
            tmpdir, tiff_cmyk16_img, miff_cmyk16_pdf, gsdevice="tiff32nc", exact=False
        )

src/img2pdf_test.py:6422:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk162/gs-1.tiff', exact = False
icc = False, cmyk = False

    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
            assert psnr != b"0 (0)"
            assert psnr_re.fullmatch(psnr) is not None, psnr
            psnr = psnr_re.fullmatch(psnr).group(1)
            psnr = float(psnr)
            assert psnr != 0  # or otherwise we would use the exact variant
>           assert psnr > 50
E           assert 6.35075 > 50

src/img2pdf_test.py:396: AssertionError
=============================== warnings summary ===============================
src/img2pdf_test.py:130
  /build/img2pdf-0.5.0/src/img2pdf_test.py:130: UserWarning: imagemagick has no jpeg 2000 support, skipping certain checks...
    warnings.warn("imagemagick has no jpeg 2000 support, skipping certain checks...")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED src/img2pdf_test.py::test_miff_cmyk8[internal] - AssertionError: assert b'0 (0)' != b'0 (0)'
FAILED src/img2pdf_test.py::test_miff_cmyk8[pikepdf] - AssertionError: assert b'0 (0)' != b'0 (0)'
FAILED src/img2pdf_test.py::test_miff_cmyk16[internal] - assert 6.35075 > 50
FAILED src/img2pdf_test.py::test_miff_cmyk16[pikepdf] - assert 6.35075 > 50
===== 4 failed, 313 passed, 16 skipped, 18 deselected, 1 warning in 36.74s =====

Description of changes

Changelog: https://gitlab.mister-muffin.de/josch/img2pdf/src/tag/0.5.0/CHANGES.rst

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot requested a review from veprbl October 29, 2023 08:17
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 labels Oct 29, 2023
@jtojnar
Copy link
Member

jtojnar commented Oct 29, 2023

Those errors sound like they could be upstream, possibly due to some versions of some dependencies:

Test log
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.2.0
rootdir: /build/img2pdf-0.5.0
collected 351 items / 18 deselected / 333 selected                             
src/img2pdf_test.py ......ssssss..........................ss............ [ 15%]
......................................FFFF.............................. [ 37%]
........................................................................ [ 58%]
........................................................................ [ 80%]
.........ssssssss................................................        [100%]
=================================== FAILURES ===================================
__________________________ test_miff_cmyk8[internal] ___________________________
tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685de10>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk80/in.miff')
tiff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff')
miff_cmyk8_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk8_pdf0/out.pdf')
    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk8(tmp_path_factory, miff_cmyk8_img, tiff_cmyk8_img, miff_cmyk8_pdf):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk8")
>       compare_ghostscript(
            tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc", exact=False
        )
src/img2pdf_test.py:6406: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk81/gs-1.tiff', exact = False
icc = False, cmyk = False
    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
>           assert psnr != b"0 (0)"
E           AssertionError: assert b'0 (0)' != b'0 (0)'
src/img2pdf_test.py:391: AssertionError
___________________________ test_miff_cmyk8[pikepdf] ___________________________
tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685de10>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk80/in.miff')
tiff_cmyk8_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff')
miff_cmyk8_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk8_pdf1/out.pdf')
    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk8(tmp_path_factory, miff_cmyk8_img, tiff_cmyk8_img, miff_cmyk8_pdf):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk8")
>       compare_ghostscript(
            tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc", exact=False
        )
src/img2pdf_test.py:6406: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk80/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk82/gs-1.tiff', exact = False
icc = False, cmyk = False
    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
>           assert psnr != b"0 (0)"
E           AssertionError: assert b'0 (0)' != b'0 (0)'
src/img2pdf_test.py:391: AssertionError
__________________________ test_miff_cmyk16[internal] __________________________
tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685de10>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk160/in.miff')
tiff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff')
miff_cmyk16_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk16_pdf0/out.pdf')
    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk16(
        tmp_path_factory, miff_cmyk16_img, tiff_cmyk16_img, miff_cmyk16_pdf
    ):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk16")
>       compare_ghostscript(
            tmpdir, tiff_cmyk16_img, miff_cmyk16_pdf, gsdevice="tiff32nc", exact=False
        )
src/img2pdf_test.py:6422: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk161/gs-1.tiff', exact = False
icc = False, cmyk = False
    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
            assert psnr != b"0 (0)"
            assert psnr_re.fullmatch(psnr) is not None, psnr
            psnr = psnr_re.fullmatch(psnr).group(1)
            psnr = float(psnr)
            assert psnr != 0  # or otherwise we would use the exact variant
>           assert psnr > 50
E           assert 6.35075 > 50
src/img2pdf_test.py:396: AssertionError
__________________________ test_miff_cmyk16[pikepdf] ___________________________
tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff685de10>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'), _retention_count=3, _retention_policy='all')
miff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk160/in.miff')
tiff_cmyk16_img = PosixPath('/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff')
miff_cmyk16_pdf = PosixPath('/build/pytest-of-nixbld/pytest-0/miff_cmyk16_pdf1/out.pdf')
    @pytest.mark.skipif(
        sys.platform in ["win32"],
        reason="test utilities not available on Windows and MacOS",
    )
    def test_miff_cmyk16(
        tmp_path_factory, miff_cmyk16_img, tiff_cmyk16_img, miff_cmyk16_pdf
    ):
        tmpdir = tmp_path_factory.mktemp("miff_cmyk16")
>       compare_ghostscript(
            tmpdir, tiff_cmyk16_img, miff_cmyk16_pdf, gsdevice="tiff32nc", exact=False
        )
src/img2pdf_test.py:6422: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/img2pdf_test.py:418: in compare_ghostscript
    compare(str(img), str(tmpdir / "gs-1.") + ext, exact, icc, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
im1 = '/build/pytest-of-nixbld/pytest-0/tiff_cmyk160/in.tiff'
im2 = '/build/pytest-of-nixbld/pytest-0/miff_cmyk162/gs-1.tiff', exact = False
icc = False, cmyk = False
    def compare(im1, im2, exact, icc, cmyk):
        if exact:
            if cmyk and not HAVE_EXACT_CMYK8:
                raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48")
            elif icc:
                raise Exception("icc cannot be exact")
            else:
                subprocess.check_call(
                    COMPARE
                    + [
                        "-metric",
                        "AE",
                        "-alpha",
                        "off",
                        im1,
                        im2,
                        "null:",
                    ]
                )
        else:
            iccargs = []
            if icc:
                if ICC_PROFILE is None:
                    pytest.skip("Could not locate an ICC profile")
                iccargs = ["-profile", ICC_PROFILE]
            psnr = subprocess.run(
                COMPARE
                + iccargs
                + [
                    "-metric",
                    "PSNR",
                    im1,
                    im2,
                    "null:",
                ],
                check=False,
                stderr=subprocess.PIPE,
            ).stderr
            assert psnr != b"0"
            assert psnr != b"0 (0)"
            assert psnr_re.fullmatch(psnr) is not None, psnr
            psnr = psnr_re.fullmatch(psnr).group(1)
            psnr = float(psnr)
            assert psnr != 0  # or otherwise we would use the exact variant
>           assert psnr > 50
E           assert 6.35075 > 50
src/img2pdf_test.py:396: AssertionError
=============================== warnings summary ===============================
src/img2pdf_test.py:130
  /build/img2pdf-0.5.0/src/img2pdf_test.py:130: UserWarning: imagemagick has no jpeg 2000 support, skipping certain checks...
    warnings.warn("imagemagick has no jpeg 2000 support, skipping certain checks...")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED src/img2pdf_test.py::test_miff_cmyk8[internal] - AssertionError: assert b'0 (0)' != b'0 (0)'
FAILED src/img2pdf_test.py::test_miff_cmyk8[pikepdf] - AssertionError: assert b'0 (0)' != b'0 (0)'
FAILED src/img2pdf_test.py::test_miff_cmyk16[internal] - assert 6.35075 > 50
FAILED src/img2pdf_test.py::test_miff_cmyk16[pikepdf] - assert 6.35075 > 50
===== 4 failed, 313 passed, 16 skipped, 18 deselected, 1 warning in 40.25s =====

By the way test_png_gray1 is supposed to have been fixed by https://gitlab.mister-muffin.de/josch/img2pdf/commit/64d27f4a8bda2ab21ed34775c1bedfc853d42bf2 so it can probably be removed from disabledTests.

@mweinelt
Copy link
Member

Last time I interacted with upstream they appreciated our bug reports.

https://gitlab.mister-muffin.de/josch/img2pdf/issues/148#issuecomment-816

@josch
Copy link

josch commented Nov 1, 2023

Last time I interacted with upstream they appreciated our bug reports.

While upstream still very much appreciates bug reports, these test case failures are very likely just because different versions of imagemagick decide to do things differently and I often do not find the time to track down where imagemagick started doing things differently and why and if that's a problem of how the tests are set up or a new bug in imagemagick.

So if you are in doubt, just disable the failing tests.

If you want to help, please help bisecting imagemagick to see where it started behaving differently. Thank you!

@dotlambda
Copy link
Member Author

If you want to help, please help bisecting imagemagick to see where it started behaving differently.

Are you interested in the version on which the failures started or the exact imagemagick commit?

@josch
Copy link

josch commented Nov 1, 2023

Are you interested in the version on which the failures started or the exact imagemagick commit?

Well, ideally the commit but obviously finding that takes a bit of time. So it would already be great to know some versions so that I have some good and bad commits to start bisecting. 😄

@dotlambda
Copy link
Member Author

dotlambda commented Nov 1, 2023

For now I can say that the two tests (and more) also fail with ImageMagick 7.0.9-4. Many older versions fail to build for me.
The two tests don't fail with ImageMagick 7.0.7-0 but others do.

@dotlambda dotlambda merged commit 36824b3 into NixOS:master Nov 2, 2023
21 of 22 checks passed
@dotlambda dotlambda deleted the img2pdf-0.5.0 branch November 2, 2023 16:28
al3xtjames added a commit to al3xtjames/nixpkgs that referenced this pull request Nov 6, 2023
The img2pdf derivation uses the sRGB ICC profile provided by colord
starting with NixOS#264119. colord and several of its dependencies only
support Linux, so this broke evaluation on Darwin. This change drops the
use of colord on Darwin to fix the derivation; the system-provided sRGB
profile is used instead.
nyabinary pushed a commit to nyabinary/nixpkgs that referenced this pull request Nov 14, 2023
The img2pdf derivation uses the sRGB ICC profile provided by colord
starting with NixOS#264119. colord and several of its dependencies only
support Linux, so this broke evaluation on Darwin. This change drops the
use of colord on Darwin to fix the derivation; the system-provided sRGB
profile is used instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants