style: fix black formatting for test_render_adapter.py (line-length=120)
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 25s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1579h9m43s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1579h9m44s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1579h9m45s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1579h9m45s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1579h9m46s
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1579h41m17s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 25s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1579h9m43s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1579h9m44s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1579h9m45s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1579h9m45s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1579h9m46s
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1579h41m17s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
This commit is contained in:
@@ -104,9 +104,7 @@ class TestValidatePlan:
|
||||
adapter, mock_plan_repo, _ = _make_adapter(plan=None)
|
||||
mock_plan_repo.get.return_value = None
|
||||
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan(
|
||||
"plan_001"
|
||||
)
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan("plan_001")
|
||||
|
||||
assert not valid
|
||||
assert len(errors) == 1
|
||||
@@ -119,9 +117,7 @@ class TestValidatePlan:
|
||||
plan = FakePlan(id="plan_001", status="editing")
|
||||
adapter, _, mock_clip_repo = _make_adapter(plan=plan, clips=[])
|
||||
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan(
|
||||
"plan_001"
|
||||
)
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan("plan_001")
|
||||
|
||||
assert not valid
|
||||
assert any("没有任何片段" in e for e in errors)
|
||||
@@ -135,9 +131,7 @@ class TestValidatePlan:
|
||||
]
|
||||
adapter, _, _ = _make_adapter(plan=plan, clips=clips)
|
||||
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan(
|
||||
"plan_001"
|
||||
)
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan("plan_001")
|
||||
|
||||
assert not valid
|
||||
assert any("没有就绪" in e for e in errors)
|
||||
@@ -152,9 +146,7 @@ class TestValidatePlan:
|
||||
]
|
||||
adapter, _, _ = _make_adapter(plan=plan, clips=clips)
|
||||
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan(
|
||||
"plan_001"
|
||||
)
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan("plan_001")
|
||||
|
||||
assert not valid
|
||||
assert any("没有分配素材" in e for e in errors)
|
||||
@@ -168,9 +160,7 @@ class TestValidatePlan:
|
||||
]
|
||||
adapter, _, _ = _make_adapter(plan=plan, clips=clips)
|
||||
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan(
|
||||
"plan_001"
|
||||
)
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan("plan_001")
|
||||
|
||||
assert valid
|
||||
assert len(errors) == 0
|
||||
@@ -198,9 +188,7 @@ class TestValidatePlan:
|
||||
]
|
||||
adapter, _, _ = _make_adapter(plan=plan, clips=clips)
|
||||
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan(
|
||||
"plan_001"
|
||||
)
|
||||
valid, errors, warnings, ready_count, total_count = adapter.validate_plan("plan_001")
|
||||
|
||||
assert valid
|
||||
assert any("pending" in w for w in warnings)
|
||||
@@ -252,9 +240,7 @@ class TestRenderPlan:
|
||||
@patch("video_processing.render_adapter.upload_to_oss")
|
||||
@patch("video_processing.render_adapter.UnifiedRenderService")
|
||||
@patch("video_processing.render_adapter.download_asset")
|
||||
def test_successful_render(
|
||||
self, mock_download, mock_render_cls, mock_upload, tmp_path
|
||||
):
|
||||
def test_successful_render(self, mock_download, mock_render_cls, mock_upload, tmp_path):
|
||||
"""完整渲染流程成功。"""
|
||||
|
||||
# 素材下载成功
|
||||
@@ -277,9 +263,7 @@ class TestRenderPlan:
|
||||
mock_render_cls.return_value = mock_render
|
||||
|
||||
# 上传成功
|
||||
mock_upload.return_value = (
|
||||
"https://oss.example.com/rendered/plan_001/job_001.mp4"
|
||||
)
|
||||
mock_upload.return_value = "https://oss.example.com/rendered/plan_001/job_001.mp4"
|
||||
|
||||
plan = FakePlan(id="plan_001", status="editing")
|
||||
clips = [
|
||||
@@ -320,9 +304,7 @@ class TestRenderPlan:
|
||||
mock_download.side_effect = _fake_download
|
||||
|
||||
# 模拟渲染异常,避免走到最后
|
||||
with patch(
|
||||
"video_processing.render_adapter.UnifiedRenderService"
|
||||
) as mock_render_cls:
|
||||
with patch("video_processing.render_adapter.UnifiedRenderService") as mock_render_cls:
|
||||
mock_render = MagicMock()
|
||||
mock_render.render.side_effect = RuntimeError("render error")
|
||||
mock_render_cls.return_value = mock_render
|
||||
@@ -362,9 +344,7 @@ class TestRenderPlan:
|
||||
|
||||
mock_download.side_effect = _fake_download
|
||||
|
||||
with patch(
|
||||
"video_processing.render_adapter.UnifiedRenderService"
|
||||
) as mock_render_cls:
|
||||
with patch("video_processing.render_adapter.UnifiedRenderService") as mock_render_cls:
|
||||
mock_render = MagicMock()
|
||||
mock_render.render.return_value = MagicMock(
|
||||
output_path=tmp_path / "out.mp4",
|
||||
@@ -375,10 +355,7 @@ class TestRenderPlan:
|
||||
)
|
||||
mock_render_cls.return_value = mock_render
|
||||
|
||||
with patch(
|
||||
"video_processing.render_adapter.upload_to_oss",
|
||||
return_value="https://example.com/out.mp4",
|
||||
):
|
||||
with patch("video_processing.render_adapter.upload_to_oss", return_value="https://example.com/out.mp4"):
|
||||
plan = FakePlan(id="plan_001", status="editing")
|
||||
clips = [
|
||||
_make_clip("c1", order=0, duration=3.0, asset_id="asset_001.mp4"),
|
||||
|
||||
Reference in New Issue
Block a user