diff --git a/src/thumbor_video_engine/engines/video.py b/src/thumbor_video_engine/engines/video.py index 113c874..8fb51a5 100644 --- a/src/thumbor_video_engine/engines/video.py +++ b/src/thumbor_video_engine/engines/video.py @@ -125,7 +125,7 @@ def __getattribute__(self, attr): # or video_engine class, when appropriate, for self.__class__ if attr == "__class__" and self.__dict__.get("engine"): return self.__dict__["engine"].__class__ - return super().__getattribute__(attr) + return object.__getattribute__(self, attr) def __getattr__(self, attr): if not self.__dict__.get('engine'): diff --git a/tests/engines/test_video_engine.py b/tests/engines/test_video_engine.py index 5b91da7..2cc961d 100644 --- a/tests/engines/test_video_engine.py +++ b/tests/engines/test_video_engine.py @@ -15,7 +15,7 @@ def assert_colors_similar(rgb1, rgb2, message): delta_e = color_diff(rgb1, rgb2) - assert delta_e < 0.05, f"{message}: {repr_rgb(rgb1)} != {repr_rgb(rgb2)}" + assert delta_e < 0.05, "%s: %s != %s" % (message, repr_rgb(rgb1), repr_rgb(rgb2)) @pytest.fixture diff --git a/tests/result_storages/test_file_storage.py b/tests/result_storages/test_file_storage.py index aab1992..82177e3 100644 --- a/tests/result_storages/test_file_storage.py +++ b/tests/result_storages/test_file_storage.py @@ -3,7 +3,7 @@ import pytest -from thumbor_video_engine.engines.video import Engine as VideoEngine +from thumbor_video_engine.engines.ffmpeg import Engine as FFMpegEngine @pytest.fixture @@ -55,12 +55,12 @@ def test_file_result_storage_retrieve(config, mocker, http_client, base_url, tmp src_file, "%s/%s/ba/68/88258f0b20357d15380b611a7b31da32f19b" % (tmp_path, subdir)) - mocker.spy(VideoEngine, "load") + mocker.spy(FFMpegEngine, "load") response = yield http_client.fetch("%s/unsafe/hotdog.gif" % base_url, headers={'Accept': mime_type}) assert response.code == 200 - assert VideoEngine.load.call_count == 0 + assert FFMpegEngine.load.call_count == 0 assert response.headers.get('content-type') == mime_type if auto_gif: assert response.headers.get('vary') == 'Accept' @@ -71,7 +71,7 @@ def test_file_result_storage_retrieve(config, mocker, http_client, base_url, tmp "%s/unsafe/pbj-time.gif" % base_url, headers={'Accept': mime_type}) assert response.code == 200 - assert VideoEngine.load.call_count == 1 + assert FFMpegEngine.load.call_count == 1 @pytest.mark.gen_test @@ -92,15 +92,15 @@ def test_file_result_storage_legacy_retrieve( src_file, "%s/v2%s/un/sa/unsafe/hotdog.gif" % (tmp_path, subdir)) - mocker.spy(VideoEngine, "load") + mocker.spy(FFMpegEngine, "load") response = yield http_client.fetch("%s/unsafe/hotdog.gif" % base_url, headers={'Accept': accept}) assert response.code == 200 - assert VideoEngine.load.call_count == 0 + assert FFMpegEngine.load.call_count == 0 response = yield http_client.fetch( "%s/unsafe/pbj-time.gif" % base_url, headers={'Accept': accept}) assert response.code == 200 - assert VideoEngine.load.call_count == 1 + assert FFMpegEngine.load.call_count == 1 diff --git a/tests/result_storages/test_s3_storage.py b/tests/result_storages/test_s3_storage.py index a010092..981cb3e 100644 --- a/tests/result_storages/test_s3_storage.py +++ b/tests/result_storages/test_s3_storage.py @@ -14,7 +14,7 @@ asyncio = None from thumbor.engines import BaseEngine -from thumbor_video_engine.engines.video import Engine as VideoEngine +from thumbor_video_engine.engines.ffmpeg import Engine as FFMpegEngine # Subclassed Popen that gets around mirakuru not capturing stderr @@ -106,7 +106,7 @@ def test_s3_result_storage_load(mocker, config, http_client, base_url, auto_gif, if mime_type == 'image/gif': config.FFMPEG_GIF_AUTO_H264 = False - mocker.spy(VideoEngine, "load") + mocker.spy(FFMpegEngine, "load") if not auto_gif and mime_type != 'image/png': bucket_key = 'unsafe/hotdog.gif' @@ -134,7 +134,7 @@ def test_s3_result_storage_load(mocker, config, http_client, base_url, auto_gif, assert response.headers.get("vary") == "Accept" else: assert response.headers.get("vary") is None - assert VideoEngine.load.call_count == 0 + assert FFMpegEngine.load.call_count == 0 @pytest.mark.skipif(Bucket is None, reason="tc_aws unavailable") diff --git a/tests/utils.py b/tests/utils.py index 7dcb23b..4c1fbdf 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import math