Django

Code

Ticket #8196 (closed: fixed)

Opened 4 months ago

Last modified 3 months ago

modeltests/model_forms tests fail on a system without PIL installed

Reported by: ramiro Assigned to: Gulopine
Milestone: Component: Testing framework
Version: SVN Keywords:
Cc: richard.davies@elastichosts.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

8196-r8425.diff (2.3 kB) - added by Gulopine on 08/17/08 15:12:05.
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@elastichosts.com> on 09/01/08 05:30:11.
Updated patch so it still applies cleanly to r8757

Change History

08/09/08 16:47:22 changed by bastih

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • component changed from Uncategorized to Unit test system.
  • needs_tests changed.
  • needs_docs changed.

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

08/11/08 15:19:53 changed by Gulopine

  • owner changed from nobody to Gulopine.
  • status changed from new to assigned.

08/17/08 15:12:05 changed by Gulopine

  • attachment 8196-r8425.diff added.

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

08/31/08 03:10:28 changed by Richard Davies <richard.davies@elastichosts.com>

  • cc set to richard.davies@elastichosts.com.
  • has_patch set to 1.

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]

09/01/08 05:30:11 changed by Richard Davies <richard.davies@elastichosts.com>

  • attachment 8196-r8757.diff added.

Updated patch so it still applies cleanly to r8757

09/01/08 22:07:27 changed by mtredinnick

  • status changed from assigned to closed.
  • resolution set to fixed.

(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.


Add/Change #8196 (modeltests/model_forms tests fail on a system without PIL installed)




Change Properties
Action