mirror of https://github.com/django/django.git
Fixed MultipleFileFieldTest.test_file_multiple_validation() test if Pillow isn't installed.
Follow up to fb4c55d9ec
.
This commit is contained in:
parent
f5b39b77e3
commit
fcfbf08abe
|
@ -1,4 +1,5 @@
|
|||
import pickle
|
||||
import unittest
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
|
@ -6,6 +7,13 @@ from django.core.validators import validate_image_file_extension
|
|||
from django.forms import FileField, FileInput
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
try:
|
||||
from PIL import Image # NOQA
|
||||
except ImportError:
|
||||
HAS_PILLOW = False
|
||||
else:
|
||||
HAS_PILLOW = True
|
||||
|
||||
|
||||
class FileFieldTest(SimpleTestCase):
|
||||
def test_filefield_1(self):
|
||||
|
@ -151,6 +159,7 @@ class MultipleFileFieldTest(SimpleTestCase):
|
|||
with self.assertRaisesMessage(ValidationError, msg):
|
||||
f.clean(files[::-1])
|
||||
|
||||
@unittest.skipUnless(HAS_PILLOW, "Pillow not installed")
|
||||
def test_file_multiple_validation(self):
|
||||
f = MultipleFileField(validators=[validate_image_file_extension])
|
||||
|
||||
|
|
Loading…
Reference in New Issue