stephenmcd / mezzanine

CMS framework for Django
http://mezzanine.jupo.org
BSD 2-Clause "Simplified" License
4.75k stars 1.64k forks source link

[BUG] Galleries test failure due to thumbnail returning original URL #2065

Open molokov opened 8 months ago

molokov commented 8 months ago

Is there an existing issue for this?

Current Behavior

The test case test_galleries.py will fail, due to this error:

tests/test_galleries.py:45: in test_thumbnail_generation
    self.assertEqual(os.path.normpath(thumb_image.lstrip("/")), thumb_name)
E   AssertionError: 'image.jpg' != '.thumbnails/image.jpg/image-24x24.jpg'
E   - image.jpg
E   + .thumbnails/image.jpg/image-24x24.jpg

On investigation, this turns out to be in the final step of thumbnail where the image is saved, which gives this exception (when traceback is printed):

Traceback (most recent call last):
  File "/workspace/mezdev/mezzanine/mezzanine/core/templatetags/mezzanine_tags.py", line 451, in thumbnail
    image = ImageOps.fit(image, to_size, Image.ANTIALIAS, 0, to_pos)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

The name ANTIALIAS was removed in PIL 10.0.0 and should be replaced with LANCZOS (ref: https://stackoverflow.com/a/76616129/653093 )

Expected Behavior

Test case to pass

Steps To Reproduce

Run the test_galleries.py test case

Environment

- Operating System: Ubuntu 22.04
- Python version: 3.10.12
- Django version: 4.1
- Database engine and version: default used by tox
- Mezzanine version: master

Anything else?

No response

molokov commented 8 months ago

I've applied the fix in my fork at https://github.com/molokov/mezzanine/commit/a89ef45c66569b542dc59a1fc735f66e4a11f876

Having trouble opening a PR - but that may be my fault, I've got other commits on my master branch unrelated to this.

Samet1994 commented 7 months ago

[](url

@18ga7JY5DeQrGxms1k6k4Qh2DDX43ntiZU

Samet1994 commented 7 months ago

18ga7JY5DeQrGxms1k6k4Qh2DDX43ntiZU