Opened 7 years ago

Closed 7 years ago

#8196 closed (fixed)

modeltests/model_forms tests fail on a system without PIL installed

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

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 Gulopine 7 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@…> 7 years ago.
Updated patch so it still applies cleanly to r8757

Download all attachments as: .zip

Change History (6)

comment:1 Changed 7 years ago by bastih

  • Component changed from Uncategorized to Unit test system
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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

comment:2 Changed 7 years ago by Gulopine

  • Owner changed from nobody to Gulopine
  • Status changed from new to assigned

Changed 7 years ago by Gulopine

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

comment:3 Changed 7 years ago by Richard Davies <richard.davies@…>

  • 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]

Changed 7 years ago by Richard Davies <richard.davies@…>

Updated patch so it still applies cleanly to r8757

comment:4 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from assigned to closed

(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