#25108 closed Bug (fixed)
Tests fails when using Pillow 2.9.0
Reported by: | Yosuke Yasuda | Owned by: | Yosuke Yasuda |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | test |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
A test failed in python3.4.3
$ ./runtests.py ./forms_tests Testing against Django installed in '/Users/yasudayousuke/oss_hack/django_dev/django_parent/django' Creating test database for alias 'default'... Creating test database for alias 'other'... ..................................................................................................................F.....................................................................................................................................................................................................................................................................................................................s........... ====================================================================== FAIL: test_imagefield_annotate_with_bitmap_image_after_clean (forms_tests.tests.test_fields.FieldsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/yasudayousuke/oss_hack/django_dev/django_parent/tests/forms_tests/tests/test_fields.py", line 862, in test_imagefield_annotate_with_bitmap_image_after_clean self.assertIsNone(uploaded_file.content_type) AssertionError: 'image/bmp' is not None
Probably the cause is the change of library Pillow added few days ago.
https://github.com/python-pillow/Pillow/commit/fe18b039ca9e11c6deed8f21a9e5eca815badbb7
My Pillow version is 2.9.0, so the content_type is "image/bmp" and is not None.
Attachments (1)
Change History (9)
by , 9 years ago
Attachment: | 25108.diff added |
---|
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
follow-up: 4 comment:2 by , 9 years ago
Component: | HTTP handling → Forms |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 9 years ago
Then, should I choose a different type of image which Pillow doesn't detect the MIME type?
comment:4 by , 9 years ago
Replying to timgraham:
The original purpose of this test is to check the case when Pillow doesn't detect the MIME type of the image, so we need to find a new case of that if possible.
Then, should I choose a different type of image which Pillow doesn't detect the MIME type? Or can I set file extension which doesn't exist?
I searched Pillow. I found that it is merging the code that detect MIME type.
https://github.com/python-pillow/Pillow/search?p=1&q=MIME&utf8=%E2%9C%93
So if I find an image type that Pillow doesn't detect now, the same kind of issue may happen later.
comment:5 by , 9 years ago
I found a tga file can be ImageFile and its MIME type is not detected, so I changed bmp to tga.
comment:6 by , 9 years ago
Yes, after previous ticket I added MIME for BMP, so it will fail.
I think it is better to use mock to model this situation instead of fixing every time after Pillow registers MIME for image plugin without it.
The original purpose of this test is to check the case when Pillow doesn't detect the MIME type of the image, so we need to find a new case of that if possible.