From 4965a774074780f3e4858bcc975476f71edf2c2c Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 21 Mar 2014 10:54:53 -0400 Subject: Removed PIL compatability layer per deprecation timeline. refs #19934. --- tests/model_fields/models.py | 10 ++++------ tests/model_fields/test_imagefield.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'tests/model_fields') diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index c4e99c949a..5fe4104851 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -2,11 +2,9 @@ import os import tempfile import warnings -from django.core.exceptions import ImproperlyConfigured - try: - from django.utils.image import Image -except ImproperlyConfigured: + from PIL import Image +except ImportError: Image = None from django.core.files.storage import FileSystemStorage @@ -114,7 +112,7 @@ class VerboseNameField(models.Model): field9 = models.FileField("verbose field9", upload_to="unused") field10 = models.FilePathField("verbose field10") field11 = models.FloatField("verbose field11") - # Don't want to depend on Pillow/PIL in this test + # Don't want to depend on Pillow in this test #field_image = models.ImageField("verbose field") field12 = models.IntegerField("verbose field12") with warnings.catch_warnings(record=True) as w: @@ -151,7 +149,7 @@ class Document(models.Model): ############################################################################### # ImageField -# If Pillow/PIL available, do these tests. +# If Pillow available, do these tests. if Image: class TestImageFieldFile(ImageFieldFile): """ diff --git a/tests/model_fields/test_imagefield.py b/tests/model_fields/test_imagefield.py index 90b7a65727..be8584a571 100644 --- a/tests/model_fields/test_imagefield.py +++ b/tests/model_fields/test_imagefield.py @@ -20,7 +20,7 @@ if Image: PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile) from .models import temp_storage_dir else: - # Pillow/PIL not available, create dummy classes (tests will be skipped anyway) + # Pillow not available, create dummy classes (tests will be skipped anyway) class Person(): pass PersonWithHeight = PersonWithHeightAndWidth = PersonDimensionsFirst = Person @@ -93,7 +93,7 @@ class ImageFieldTestMixin(object): self.assertEqual(getattr(instance, height_field_name), height) -@skipIf(Image is None, "Pillow/PIL is required to test ImageField") +@skipIf(Image is None, "Pillow is required to test ImageField") class ImageFieldTests(ImageFieldTestMixin, TestCase): """ Tests for ImageField that don't need to be run with each of the @@ -180,7 +180,7 @@ class ImageFieldTests(ImageFieldTestMixin, TestCase): self.assertEqual(p.mugshot, loaded_p.mugshot) -@skipIf(Image is None, "Pillow/PIL is required to test ImageField") +@skipIf(Image is None, "Pillow is required to test ImageField") class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase): """ Tests behavior of an ImageField and its dimensions fields. @@ -294,7 +294,7 @@ class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase): self.assertEqual(p.mugshot.was_opened, True) -@skipIf(Image is None, "Pillow/PIL is required to test ImageField") +@skipIf(Image is None, "Pillow is required to test ImageField") class ImageFieldNoDimensionsTests(ImageFieldTwoDimensionsTests): """ Tests behavior of an ImageField with no dimension fields. @@ -303,7 +303,7 @@ class ImageFieldNoDimensionsTests(ImageFieldTwoDimensionsTests): PersonModel = Person -@skipIf(Image is None, "Pillow/PIL is required to test ImageField") +@skipIf(Image is None, "Pillow is required to test ImageField") class ImageFieldOneDimensionTests(ImageFieldTwoDimensionsTests): """ Tests behavior of an ImageField with one dimensions field. @@ -312,7 +312,7 @@ class ImageFieldOneDimensionTests(ImageFieldTwoDimensionsTests): PersonModel = PersonWithHeight -@skipIf(Image is None, "Pillow/PIL is required to test ImageField") +@skipIf(Image is None, "Pillow is required to test ImageField") class ImageFieldDimensionsFirstTests(ImageFieldTwoDimensionsTests): """ Tests behavior of an ImageField where the dimensions fields are @@ -322,7 +322,7 @@ class ImageFieldDimensionsFirstTests(ImageFieldTwoDimensionsTests): PersonModel = PersonDimensionsFirst -@skipIf(Image is None, "Pillow/PIL is required to test ImageField") +@skipIf(Image is None, "Pillow is required to test ImageField") class ImageFieldUsingFileTests(ImageFieldTwoDimensionsTests): """ Tests behavior of an ImageField when assigning it a File instance @@ -333,7 +333,7 @@ class ImageFieldUsingFileTests(ImageFieldTwoDimensionsTests): File = File -@skipIf(Image is None, "Pillow/PIL is required to test ImageField") +@skipIf(Image is None, "Pillow is required to test ImageField") class TwoImageFieldTests(ImageFieldTestMixin, TestCase): """ Tests a model with two ImageFields. -- cgit v1.3