From 84febfe666795ff062ed142c9345edbb67cb5dbd Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 09:33:03 +0400 Subject: [PATCH 01/10] switch to ubuntu trusty 14.04 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 703121f77..b88dc5ff2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ python: - 3.4 - nightly +dist: trusty + install: - "travis_retry sudo apt-get update" - "travis_retry sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick" From 44e784a95e4af1dff6c2925f2ceb397f30852b84 Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 10:04:17 +0400 Subject: [PATCH 02/10] skip test_jp2_icon test when use PyPy 5.4.1 --- Tests/test_file_icns.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index 92fe136f2..376124d19 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" @@ -61,6 +67,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 From 93738c3b43340dd1c73c6d2048a206b9671942b6 Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 10:10:46 +0400 Subject: [PATCH 03/10] skip test_older_icon with pypy 5.4.1 --- Tests/test_file_icns.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index 376124d19..6d649aabc 100644 --- a/Tests/test_file_icns.py +++ b/Tests/test_file_icns.py @@ -54,6 +54,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). From 5bdb95783f34d30e086267fd4fcd1af4c511f594 Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 10:18:27 +0400 Subject: [PATCH 04/10] skip test_sizes with pypy 5.4.1 --- Tests/test_file_icns.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index 6d649aabc..5b3963c56 100644 --- a/Tests/test_file_icns.py +++ b/Tests/test_file_icns.py @@ -41,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 From 2957993730ff71ea97e061422d4dd343679dd53d Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 10:43:29 +0400 Subject: [PATCH 05/10] skip test_only_save_relevant_sizes test with pypy 5.4.1 --- Tests/test_file_ico.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 From 77b69e6d00aed98f5276b1dc98daf086141c3bde Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 10:52:31 +0400 Subject: [PATCH 06/10] skip test_fromarray test with pypy 5.4.1 --- Tests/test_image_array.py | 7 +++++++ 1 file changed, 7 insertions(+) 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): From 40dc3ba32e40df6ad31438d5b09159e7f7efda5f Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 10:59:45 +0400 Subject: [PATCH 07/10] test test_ico test with pypy 5.4.1 --- Tests/test_imagefile.py | 7 +++++++ 1 file changed, 7 insertions(+) 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() From 5d58335f5257d67b56e60b81e77ca7d17d962439 Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 11:20:36 +0400 Subject: [PATCH 08/10] fix SystemError: new style getargs format but argument is not a tuple --- Tests/test_imagepath.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py index 14cc4d14b..db36972fe 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(list(arr.tostring())) self.assertEqual(list(p), [(0.0, 1.0)]) def test_overflow_segfault(self): From 203cba20d7f2aaa7df13445f74abf568341af707 Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 11:35:30 +0400 Subject: [PATCH 09/10] another try --- Tests/test_imagepath.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py index db36972fe..144004b34 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(list(arr.tostring())) + p = ImagePath.Path(tuple(arr.tostring())) self.assertEqual(list(p), [(0.0, 1.0)]) def test_overflow_segfault(self): From c9499c68f1a196bcf377c2b6caaf7c80ecc0bae3 Mon Sep 17 00:00:00 2001 From: Fahad Al-Saidi Date: Thu, 15 Dec 2016 11:43:41 +0400 Subject: [PATCH 10/10] another try --- Tests/test_imagepath.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py index 144004b34..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(tuple(arr.tostring())) + p = ImagePath.Path((arr.tostring(),)) self.assertEqual(list(p), [(0.0, 1.0)]) def test_overflow_segfault(self):