I’m using sorl-thumbnail in a Django 1.2 (currently 1.2 RC) project and getting a surprising failure of four of sorl’s built-in unit tests. Essentially, the resized images are all 1px shorter than the unit tests expect them to be. See below for details
I’m developing on OSX 10.5.8 (not Snow Leopard) with Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) and PIL 1.1.6.
Any thoughts what might be up?
Cheers
Steve
======================================================================
FAIL: test_extension (sorl.thumbnail.tests.fields.FieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/fields.py", line 66, in test_extension
self.verify_thumbnail((50, 37), thumb, expected_filename)
File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/base.py", line 92, in verify_thumbnail
self.assertEqual(image.size, expected_size)
AssertionError: (50, 38) != (50, 37)
======================================================================
FAIL: test_thumbnail (sorl.thumbnail.tests.fields.ImageWithThumbnailsFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/fields.py", line 111, in test_thumbnail
self.verify_thumbnail((50, 37), thumb, expected_filename)
File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/base.py", line 92, in verify_thumbnail
self.assertEqual(image.size, expected_size)
AssertionError: (50, 38) != (50, 37)
======================================================================
FAIL: testTag (sorl.thumbnail.tests.templatetags.ThumbnailTagTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/templatetags.py", line 118, in testTag
self.verify_thumbnail((90, 67), expected_filename=expected_fn)
File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/base.py", line 92, in verify_thumbnail
self.assertEqual(image.size, expected_size)
AssertionError: (90, 68) != (90, 67)
Here’s the hack that I used to work around this. I put the following in
tests.pyin my own app:Of course, this prevents some of the tests from running. But, assuming that the library has been tested on other systems, this shouldn’t be too much of a problem.