summaryrefslogtreecommitdiff
path: root/tests/files
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-10-06 11:25:04 +0200
committerGitHub <noreply@github.com>2020-10-06 11:25:04 +0200
commitfce389af7cf95151118c9fc7cafd777a31f94946 (patch)
treeff0ccd0bd9cd9ed280e5185d9df74f320ab72e8e /tests/files
parentefe74fff25e1e85402ecb73d80eea7625246f4ea (diff)
downloaddjango-fce389af7cf95151118c9fc7cafd777a31f94946.tar.gz
Skipped GetImageDimensionsTests.test_webp when WEBP is not installed.
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/tests.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index dfb007f2fc..2df9c98f60 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -19,9 +19,11 @@ from django.core.files.uploadedfile import (
from django.test import override_settings
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
@@ -367,6 +369,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: