mirror of
https://github.com/django/django.git
synced 2025-02-04 14:37:19 +00:00
[4.2.x] Fixed MultipleFileFieldTest.test_file_multiple_validation() test if Pillow isn't installed.
Follow up to fb4c55d9ec4bb812a7fb91fa20510d91645e411b. Backport of fcfbf08abe3e6dc54894df6988024f055abc6c40 from main
This commit is contained in:
parent
2756c69601
commit
9ec1ff7879
@ -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…
x
Reference in New Issue
Block a user