Skip to content

Commit

Permalink
[3.2.x] Fixed MultipleFileFieldTest.test_file_multiple_validation() t…
Browse files Browse the repository at this point in the history
…est if Pillow isn't installed.

Follow up to fb4c55d.
Backport of fcfbf08 from main
  • Loading branch information
felixxm committed May 4, 2023
1 parent 47ef12e commit e1bbbbe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/forms_tests/field_tests/test_filefield.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import pickle
import unittest

from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import SimpleUploadedFile
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):

Expand Down Expand Up @@ -125,6 +133,7 @@ def test_file_multiple_empty(self):
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])

Expand Down

0 comments on commit e1bbbbe

Please sign in to comment.