mirror of https://github.com/django/django.git
Skipped GetImageDimensionsTests.test_webp when WEBP is not installed.
This commit is contained in:
parent
efe74fff25
commit
fce389af7c
|
@ -19,9 +19,11 @@ from django.core.files.uploadedfile import (
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PIL import Image
|
from PIL import Image, features
|
||||||
|
HAS_WEBP = features.check('webp')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Image = None
|
Image = None
|
||||||
|
HAS_WEBP = False
|
||||||
else:
|
else:
|
||||||
from django.core.files import images
|
from django.core.files import images
|
||||||
|
|
||||||
|
@ -367,6 +369,7 @@ class GetImageDimensionsTests(unittest.TestCase):
|
||||||
size = images.get_image_dimensions(fh)
|
size = images.get_image_dimensions(fh)
|
||||||
self.assertEqual(size, (None, None))
|
self.assertEqual(size, (None, None))
|
||||||
|
|
||||||
|
@unittest.skipUnless(HAS_WEBP, 'WEBP not installed')
|
||||||
def test_webp(self):
|
def test_webp(self):
|
||||||
img_path = os.path.join(os.path.dirname(__file__), 'test.webp')
|
img_path = os.path.join(os.path.dirname(__file__), 'test.webp')
|
||||||
with open(img_path, 'rb') as fh:
|
with open(img_path, 'rb') as fh:
|
||||||
|
|
Loading…
Reference in New Issue