Opened 16 years ago

Closed 16 years ago

#8196 closed (fixed)

modeltests/model_forms tests fail on a system without PIL installed

Reported by: Ramiro Morales Owned by: Marty Alchin
Component: Testing framework Version: dev
Severity: Keywords:
Cc: richard.davies@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is the output (Linux + Python 2.4.4):

======================================================================
FAIL: Doctest: modeltests.model_forms.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ramiro/hg-repos/django/trunk/django/test/_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for modeltests.model_forms.models.__test__.API_TESTS
  File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: tests/test.png>
Got:
    <FieldFile: tests/test.png>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: tests/test.png>
Got:
    <FieldFile: tests/test.png>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    f.cleaned_data['image']
Expected:
    <ImageFieldFile: tests/test.png>
Got:
    <FieldFile: tests/test.png>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: tests/test.png>
Got:
    <FieldFile: tests/test.png>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: tests/test2.png>
Got:
    <FieldFile: tests/test2.png>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: tests/test2.png>
Got:
    <FieldFile: tests/test2.png>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: None>
Got:
    <FieldFile: None>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: tests/test3.png>
Got:
    <FieldFile: tests/test3.png>
----------------------------------------------------------------------
File "/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    <ImageFieldFile: tests/test3.png>
Got:
    <FieldFile: tests/test3.png>

Also tested on a Windows system + Python 2.5.2 (see http://dpaste.com/70381/)

Attachments (2)

8196-r8425.diff (2.3 KB ) - added by Marty Alchin 16 years ago.
Replaces ImageFieldFile with ...FieldFile so it doesn't care whether it's an image or not
8196-r8757.diff (2.3 KB ) - added by Richard Davies <richard.davies@…> 16 years ago.
Updated patch so it still applies cleanly to r8757

Download all attachments as: .zip

Change History (6)

comment:1 by sebastian.hillig, 16 years ago

Component: UncategorizedUnit test system
Triage Stage: UnreviewedAccepted

Tests in there assume that PIL is installed. How does one usually test against different situations in a doctest?

comment:2 by Marty Alchin, 16 years ago

Owner: changed from nobody to Marty Alchin
Status: newassigned

by Marty Alchin, 16 years ago

Attachment: 8196-r8425.diff added

Replaces ImageFieldFile with ...FieldFile so it doesn't care whether it's an image or not

comment:3 by Richard Davies <richard.davies@…>, 16 years ago

Cc: richard.davies@… added
Has patch: set

As noted on the DjangoOnWindows page, this is one of only two tests failing under Windows (XP 32 bits) + official Python 2.5.2.

[Also note that Gulopine added a patch]

by Richard Davies <richard.davies@…>, 16 years ago

Attachment: 8196-r8757.diff added

Updated patch so it still applies cleanly to r8757

comment:4 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: assignedclosed

(In [8842]) Fixed #8196 -- Make the model_form tests also pass if you don't have PIL
installed. We weren't relying on PIL previously, but the output was different
if it wasn't installed, which was triggering spurious failures. Patch from
Marty Alchin.

Note: See TracTickets for help on using tickets.
Back to Top