summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-10-06 11:25:04 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-10-06 11:30:21 +0200
commit9deb850e234ea52ac230916b6edd5d4889449e55 (patch)
tree12f0efb00b567ba11cea4eb8f13df587e7d3d331
parent1734484f1265804aca5e84299d03d013e59dacc5 (diff)
[3.0.x] Skipped GetImageDimensionsTests.test_webp when WEBP is not installed.
Bumped minimum Pillow version to 4.2.0 in test requirements. Backport of fce389af7cf95151118c9fc7cafd777a31f94946 from master
-rw-r--r--docs/internals/contributing/writing-code/unit-tests.txt2
-rw-r--r--tests/files/tests.py5
-rw-r--r--tests/requirements/py3.txt2
3 files changed, 6 insertions, 3 deletions
diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt
index efc862dc76..ad7c5b494e 100644
--- a/docs/internals/contributing/writing-code/unit-tests.txt
+++ b/docs/internals/contributing/writing-code/unit-tests.txt
@@ -277,7 +277,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 1c005dde57..d90b79efe3 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 fd677713f8..8b8f2a6f33 100644
--- a/tests/requirements/py3.txt
+++ b/tests/requirements/py3.txt
@@ -5,7 +5,7 @@ docutils
geoip2
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