diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt index 16f2939e9f..4fe32950cb 100644 --- a/docs/internals/contributing/writing-code/unit-tests.txt +++ b/docs/internals/contributing/writing-code/unit-tests.txt @@ -235,7 +235,7 @@ dependencies: * geoip2_ * jinja2_ 2.7+ * numpy_ -* Pillow_ +* Pillow_ 4.2.0+ * PyYAML_ * pytz_ (required) * pywatchman_ diff --git a/tests/files/tests.py b/tests/files/tests.py index b50061649a..c60d69bf6a 100644 --- a/tests/files/tests.py +++ b/tests/files/tests.py @@ -17,9 +17,11 @@ from django.core.files.uploadedfile import ( ) try: - from PIL import Image + from PIL import Image, features + HAS_WEBP = features.check('webp') except ImportError: Image = None + HAS_WEBP = False else: from django.core.files import images @@ -343,6 +345,7 @@ class GetImageDimensionsTests(unittest.TestCase): size = images.get_image_dimensions(fh) self.assertEqual(size, (None, None)) + @unittest.skipUnless(HAS_WEBP, 'WEBP not installed') def test_webp(self): img_path = os.path.join(os.path.dirname(__file__), 'test.webp') with open(img_path, 'rb') as fh: diff --git a/tests/requirements/py3.txt b/tests/requirements/py3.txt index 5733df66e0..84a6bf0344 100644 --- a/tests/requirements/py3.txt +++ b/tests/requirements/py3.txt @@ -4,7 +4,7 @@ docutils geoip2 < 4.0.0 jinja2 >= 2.9.2 numpy -Pillow != 5.4.0 +Pillow >=4.2.0, != 5.4.0 # pylibmc/libmemcached can't be built on Windows. pylibmc; sys.platform != 'win32' python-memcached >= 1.59