From cbf1f228bde38c3e65fe642ec8c6c4bc4721705d Mon Sep 17 00:00:00 2001 From: CI Bot Date: Tue, 11 Aug 2026 13:41:38 +0000 Subject: [PATCH] style: auto-format with black + isort + prettier [skip ci-format-check] --- tests/unit/test_config_schemas_and_ai_endpoints.py | 3 ++- tests/unit/test_mediakit_cover.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_config_schemas_and_ai_endpoints.py b/tests/unit/test_config_schemas_and_ai_endpoints.py index 5accbc0df..7a08f5e09 100644 --- a/tests/unit/test_config_schemas_and_ai_endpoints.py +++ b/tests/unit/test_config_schemas_and_ai_endpoints.py @@ -233,9 +233,10 @@ class TestAIRunTasks: def test_run_generate_cover_ai_frame_raises_without_mediakit(self): """ai_frame cover raises RuntimeError when MediaKit is unavailable.""" - from apps.worker.worker_app.tasks.ai_tasks import run_generate_cover import pytest + from apps.worker.worker_app.tasks.ai_tasks import run_generate_cover + with pytest.raises(RuntimeError, match="MediaKit"): run_generate_cover( plan_id="plan-001", diff --git a/tests/unit/test_mediakit_cover.py b/tests/unit/test_mediakit_cover.py index 7681d8340..f37ba5543 100755 --- a/tests/unit/test_mediakit_cover.py +++ b/tests/unit/test_mediakit_cover.py @@ -174,9 +174,10 @@ class TestAICoverService: mock_client.extract_frames.side_effect = Exception("API error") mock_get_client.return_value = mock_client - from packages.shared.ai_service import _call_ai_cover_service import pytest + from packages.shared.ai_service import _call_ai_cover_service + with pytest.raises(RuntimeError, match="MediaKit"): _call_ai_cover_service( plan_id="plan-123", @@ -187,9 +188,10 @@ class TestAICoverService: def test_call_ai_cover_without_video_url_raises(self): """没有视频 URL 时抛出 RuntimeError(不再降级到 stub).""" - from packages.shared.ai_service import _call_ai_cover_service import pytest + from packages.shared.ai_service import _call_ai_cover_service + with pytest.raises(RuntimeError, match="MediaKit"): _call_ai_cover_service( plan_id="plan-123", @@ -234,9 +236,10 @@ class TestAICoverService: mock_client.is_available = False mock_get_client.return_value = mock_client - from packages.shared.ai_service import _call_ai_cover_service import pytest + from packages.shared.ai_service import _call_ai_cover_service + with pytest.raises(RuntimeError, match="MediaKit"): _call_ai_cover_service( plan_id="plan-123", @@ -253,9 +256,10 @@ class TestAICoverService: mock_client.extract_frames.return_value = [] mock_get_client.return_value = mock_client - from packages.shared.ai_service import _call_ai_cover_service import pytest + from packages.shared.ai_service import _call_ai_cover_service + with pytest.raises(RuntimeError, match="MediaKit"): _call_ai_cover_service( plan_id="plan-123",