Skip to content

Commit

Permalink
Check last log message instead of first one in FilesTest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmihelac committed Jul 29, 2024
1 parent 561ae02 commit 0fea95a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions easy_thumbnails/tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,14 @@ def test_default_subsampling(self):
@unittest.skipIf(
'easy_thumbnails.optimize' not in settings.INSTALLED_APPS,
'optimize app not installed')
@unittest.skipIf(LogCapture is None, 'testfixtures not installed')
def test_postprocessor(self):
"""use a mock image optimizing post processor doing nothing"""
settings.THUMBNAIL_OPTIMIZE_COMMAND = {
'png': 'easy_thumbnails/tests/mockoptim.py {filename}'}
with LogCapture() as logcap:
self.ext_thumbnailer.thumbnail_extension = 'png'
self.ext_thumbnailer.get_thumbnail({'size': (10, 10)})
actual = tuple(logcap.actual())[0]
actual = tuple(logcap.actual())[-1]
self.assertEqual(actual[0], 'easy_thumbnails.optimize')
self.assertEqual(actual[1], 'INFO')
self.assertRegex(
Expand All @@ -237,7 +236,7 @@ def test_postprocessor_fail(self):
with LogCapture() as logcap:
self.ext_thumbnailer.thumbnail_extension = 'png'
self.ext_thumbnailer.get_thumbnail({'size': (10, 10)})
actual = tuple(logcap.actual())[0]
actual = tuple(logcap.actual())[-1]
self.assertEqual(actual[0], 'easy_thumbnails.optimize')
self.assertEqual(actual[1], 'ERROR')
self.assertRegex(
Expand Down

0 comments on commit 0fea95a

Please sign in to comment.