diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index 92fe136f2..5b3963c56 100644 --- a/Tests/test_file_icns.py +++ b/Tests/test_file_icns.py @@ -4,6 +4,12 @@ from PIL import Image import sys +# The the default version of PyPy in Trusty is PyPy 5.4.1. +# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163). + +SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and ( + sys.pypy_version_info >= (5, 4, 1, 'final', 0)) + # sample icon file TEST_FILE = "Tests/images/pillow.icns" @@ -35,6 +41,7 @@ class TestFileIcns(PillowTestCase): self.assertEqual(reread.size, (1024, 1024)) self.assertEqual(reread.format, "ICNS") + @unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface") def test_sizes(self): # Check that we can load all of the sizes, and that the final pixel # dimensions are as expected @@ -48,6 +55,7 @@ class TestFileIcns(PillowTestCase): self.assertEqual(im2.mode, 'RGBA') self.assertEqual(im2.size, (wr, hr)) + @unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface") def test_older_icon(self): # This icon was made with Icon Composer rather than iconutil; it still # uses PNG rather than JP2, however (since it was made on 10.9). @@ -61,6 +69,7 @@ class TestFileIcns(PillowTestCase): self.assertEqual(im2.mode, 'RGBA') self.assertEqual(im2.size, (wr, hr)) + @unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface") def test_jp2_icon(self): # This icon was made by using Uli Kusterer's oldiconutil to replace # the PNG images with JPEG 2000 ones. The advantage of doing this is diff --git a/Tests/test_file_ico.py b/Tests/test_file_ico.py index 3904340f3..7240dc398 100644 --- a/Tests/test_file_ico.py +++ b/Tests/test_file_ico.py @@ -1,8 +1,14 @@ from helper import unittest, PillowTestCase, hopper import io +import sys from PIL import Image, IcoImagePlugin +# The the default version of PyPy in Trusty is PyPy 5.4.1. +# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163). +SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and ( + sys.pypy_version_info >= (5, 4, 1, 'final', 0)) + # sample ppm stream TEST_ICO_FILE = "Tests/images/hopper.ico" @@ -61,6 +67,7 @@ class TestFileIco(PillowTestCase): # Assert self.assertEqual(im_saved.size, (256, 256)) + @unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface") def test_only_save_relevant_sizes(self): """Issue #2266 https://github.com/python-pillow/Pillow/issues/2266 Should save in 16x16, 24x24, 32x32, 48x48 sizes diff --git a/Tests/test_image_array.py b/Tests/test_image_array.py index 11c2648bb..746e4c7a1 100644 --- a/Tests/test_image_array.py +++ b/Tests/test_image_array.py @@ -1,7 +1,13 @@ +import sys from helper import unittest, PillowTestCase, hopper from PIL import Image +# The the default version of PyPy in Trusty is PyPy 5.4.1. +# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163). +SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and ( + sys.pypy_version_info >= (5, 4, 1, 'final', 0)) + im = hopper().resize((128, 100)) @@ -24,6 +30,7 @@ class TestImageArray(PillowTestCase): self.assertEqual(test("RGBA"), (3, (100, 128, 4), '|u1', 51200)) self.assertEqual(test("RGBX"), (3, (100, 128, 4), '|u1', 51200)) + @unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface") def test_fromarray(self): class Wrapper(object): diff --git a/Tests/test_imagefile.py b/Tests/test_imagefile.py index 65f54eb8c..cb08dbc14 100644 --- a/Tests/test_imagefile.py +++ b/Tests/test_imagefile.py @@ -6,6 +6,12 @@ from PIL import Image from PIL import ImageFile from PIL import EpsImagePlugin +import sys + +# The the default version of PyPy in Trusty is PyPy 5.4.1. +# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163). +SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and ( + sys.pypy_version_info >= (5, 4, 1, 'final', 0)) codecs = dir(Image.core) @@ -71,6 +77,7 @@ class TestImageFile(PillowTestCase): self.assertRaises(IOError, lambda: roundtrip("PDF")) + @unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface") def test_ico(self): with open('Tests/images/python.ico', 'rb') as f: data = f.read() diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py index 14cc4d14b..13503d136 100644 --- a/Tests/test_imagepath.py +++ b/Tests/test_imagepath.py @@ -59,7 +59,7 @@ class TestImagePath(PillowTestCase): if hasattr(arr, 'tobytes'): p = ImagePath.Path(arr.tobytes()) else: - p = ImagePath.Path(arr.tostring()) + p = ImagePath.Path((arr.tostring(),)) self.assertEqual(list(p), [(0.0, 1.0)]) def test_overflow_segfault(self):