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

test_load_set_dpi fails on Windows with 7.1.2 #4583

Closed
hugovk opened this issue Apr 25, 2020 · 0 comments · Fixed by #4588
Closed

test_load_set_dpi fails on Windows with 7.1.2 #4583

hugovk opened this issue Apr 25, 2020 · 0 comments · Fixed by #4588
Labels

Comments

@hugovk
Copy link
Member

hugovk commented Apr 25, 2020

====================================================================== test session starts =======================================================================
platform win32 -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- X:\Python38\python.exe
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('D:\\Build\\Pillow\\Pillow-7.1.2\\.hypothesis\\examples')
--------------------------------------------------------------------
Pillow 7.1.2
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
--------------------------------------------------------------------
Python modules loaded from X:\Python38\lib\site-packages\PIL
Binary modules loaded from X:\Python38\lib\site-packages\PIL
--------------------------------------------------------------------
--- PIL CORE support ok
--- TKINTER support ok
--- FREETYPE2 support ok
--- LITTLECMS2 support ok
--- WEBP support ok
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok
--- OPENJPEG (JPEG2000) support ok
--- ZLIB (PNG/ZIP) support ok
--- LIBTIFF support ok
--- RAQM (Bidirectional Text) support ok
*** LIBIMAGEQUANT (Quantization method) support not installed
*** XCB (X protocol) support not installed
--------------------------------------------------------------------

rootdir: D:\Build\Pillow\Pillow-7.1.2, inifile: setup.cfg
plugins: hypothesis-5.10.4, palladium-1.2.2, cov-2.8.1, forked-1.1.3, xdist-1.31.0
collected 1456 items

Tests/test_000_sanity.py::test_sanity PASSED                                                                                                                [  0%]
<snip>
Tests/test_webp_leaks.py::TestWebPLeaks::test_leak_load SKIPPED                                                                                             [100%]

============================================================================ FAILURES ============================================================================
_______________________________________________________________________ test_load_set_dpi ________________________________________________________________________

    def test_load_set_dpi():
        with Image.open("Tests/images/drawing.wmf") as im:
            assert im.size == (82, 82)

            if hasattr(Image.core, "drawwmf"):
                im.load(144)
                assert im.size == (164, 164)

                with Image.open("Tests/images/drawing_wmf_ref_144.png") as expected:
>                   assert_image_similar(im, expected, 2.0)

Tests\test_file_wmf.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Tests\helper.py:140: in assert_image_similar
    raise e
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

a = <PIL.Image.Image image mode=RGB size=164x164 at 0x21B0019A4F0>, b = <PIL.PngImagePlugin.PngImageFile image mode=RGB size=164x164 at 0x21B0019A1F0>
epsilon = 2.0, msg = None

    def assert_image_similar(a, b, epsilon, msg=None):
        assert a.mode == b.mode, msg or "got mode {!r}, expected {!r}".format(
            a.mode, b.mode
        )
        assert a.size == b.size, msg or "got size {!r}, expected {!r}".format(
            a.size, b.size
        )

        a, b = convert_to_comparable(a, b)

        diff = 0
        for ach, bch in zip(a.split(), b.split()):
            chdiff = ImageMath.eval("abs(a - b)", a=ach, b=bch).convert("L")
            diff += sum(i * num for i, num in enumerate(chdiff.histogram()))

        ave_diff = diff / (a.size[0] * a.size[1])
        try:
>           assert epsilon >= ave_diff, (
                msg or ""
            ) + " average pixel value difference %.4f > epsilon %.4f" % (ave_diff, epsilon)
E           AssertionError:  average pixel value difference 2.0669 > epsilon 2.0000
E           assert 2.0 >= 2.0668500892325996

Tests\helper.py:130: AssertionError
---------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------
STREAM b'IHDR' 16 13
STREAM b'IDAT' 41 1152
----------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------
DEBUG    PIL.PngImagePlugin:PngImagePlugin.py:153 STREAM b'IHDR' 16 13
DEBUG    PIL.PngImagePlugin:PngImagePlugin.py:153 STREAM b'IDAT' 41 1152
======================================================================== warnings summary ========================================================================
Tests/test_file_wmf.py::test_load_raw
Tests/test_file_wmf.py::test_load_raw
Tests/test_file_wmf.py::test_load_set_dpi
  X:\Python38\lib\site-packages\PIL\WmfImagePlugin.py:51: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
    Image.core.drawwmf(im.fp.read(), im.size, self.bbox),

Tests/test_imagewin.py::TestImageWinDib::test_dib_frombytes_tobytes_roundtrip
  X:\Python38\lib\site-packages\PIL\ImageWin.py:178: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
    return self.image.frombytes(buffer)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
==================================================================== short test summary info =====================================================================
SKIPPED [1] Tests\test_file_gif.py:221: Netpbm not available
SKIPPED [1] Tests\test_file_gif.py:232: Netpbm not available
SKIPPED [1] Tests\test_file_icns.py:28: Requires macOS
SKIPPED [1] Tests\test_file_icns.py:41: Requires macOS
SKIPPED [1] Tests\test_file_msp.py:58: Extra image files not installed
SKIPPED [1] Tests\test_file_msp.py:72: Even More Extra image files not installed
SKIPPED [1] D:\Build\Pillow\Pillow-7.1.2\Tests\helper.py:170: Palm P image is wrong
SKIPPED [1] Tests\test_file_png.py:650: Requires Unix or macOS
SKIPPED [1] Tests\test_file_sun.py:35: Extra image files not installed
SKIPPED [1] Tests\test_font_leaks.py:20: Requires Unix or macOS
SKIPPED [1] Tests\test_font_leaks.py:31: Requires Unix or macOS
SKIPPED [1] Tests\test_image.py:166: Test requires opening tempfile twice
SKIPPED [1] D:\Build\Pillow\Pillow-7.1.2\Tests\test_image_quantize.py:25: libimagequant support not available
SKIPPED [1] D:\Build\Pillow\Pillow-7.1.2\Tests\test_imagedraw.py:784: failing
SKIPPED [2] Tests\test_imagefont.py:483: requires Unix or macOS
SKIPPED [2] Tests\test_imagefont.py:524: requires Unix or macOS
SKIPPED [1] Tests\test_imagegrab.py:25: requires XCB
SKIPPED [1] Tests\test_imagegrab.py:48: requires XCB
SKIPPED [1] Tests\test_imageshow.py:40: Only run on CIs; hangs on Windows on GitHub Actions
SKIPPED [1] Tests\test_map.py:11: Win32 does not call map_buffer
SKIPPED [1] Tests\test_map.py:29: Win32 does not call map_buffer
SKIPPED [1] Tests\test_shell_injection.py:24: Requires Unix or macOS
SKIPPED [1] Tests\test_shell_injection.py:33: Requires Unix or macOS
SKIPPED [1] Tests\test_shell_injection.py:38: Netpbm not available
SKIPPED [1] Tests\test_shell_injection.py:44: Netpbm not available
SKIPPED [1] Tests\test_webp_leaks.py:16: Requires Unix or macOS
==================================================== 1 failed, 1427 passed, 28 skipped, 4 warnings in 28.06s =====================================================

Originally posted by @cgohlke in #4354 (comment)

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 a pull request may close this issue.

1 participant