fix(ci): 修复develop分支CI核心链路失败(Code Quality + Unit Tests + Frontend) #1129
@@ -8,14 +8,14 @@ import type {
|
||||
UseGenerateVideoProps,
|
||||
GenerationPhase,
|
||||
} from "@/pages/generate/hooks/generate-video/types"
|
||||
import { getNextPhase, PHASE_ORDER } from "@/pages/generate/hooks/generate-video/phase"
|
||||
import { extractErrorMessage } from "@/pages/generate/hooks/generate-video/errorUtils"
|
||||
import { getDefaultVoiceConfig } from "@/pages/generate/hooks/generate-video/voiceConfig"
|
||||
import { getGenerationPhase } from "@/pages/generate/hooks/generate-video/phase"
|
||||
import { extractBackendError } from "@/pages/generate/hooks/generate-video/errorUtils"
|
||||
import { buildVoiceConfig } from "@/pages/generate/hooks/generate-video/voiceConfig"
|
||||
|
||||
describe("generate-video module smoke test", () => {
|
||||
it("should load all generate-video modules", () => {
|
||||
expect(PHASE_ORDER.length).toBeGreaterThan(0)
|
||||
expect(typeof extractErrorMessage).toBe("function")
|
||||
expect(typeof getDefaultVoiceConfig).toBe("function")
|
||||
expect(typeof getGenerationPhase).toBe("function")
|
||||
expect(typeof extractBackendError).toBe("function")
|
||||
expect(typeof buildVoiceConfig).toBe("function")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -8,10 +8,11 @@ packages / DB 等重依赖。
|
||||
"""
|
||||
|
||||
# 共享工具模块(零外部依赖,供 editing_modes / generation / edit_plan_generation 等复用)
|
||||
from . import dedup_helpers, ffmpeg_utils, oss_helpers
|
||||
from . import dedup_helpers, ffmpeg_utils, oss_helpers, url_security
|
||||
|
||||
__all__ = [
|
||||
"ffmpeg_utils",
|
||||
"oss_helpers",
|
||||
"dedup_helpers",
|
||||
"url_security",
|
||||
]
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from packages.domain.speed_config import MAX_SPEED # noqa: F401 — 向后兼容
|
||||
from packages.domain.speed_config import MIN_SPEED # noqa: F401 — 向后兼容
|
||||
from packages.domain.speed_config import (
|
||||
DEFAULT_SPEED,
|
||||
MAX_SPEED,
|
||||
MIN_SPEED,
|
||||
SpeedConfig,
|
||||
_split_atempo_stages,
|
||||
)
|
||||
@@ -70,3 +70,35 @@ class SpeedEngine:
|
||||
) -> float:
|
||||
"""从 clip config 中解析 playback_speed,0 或缺失则使用全局速度."""
|
||||
return _resolve_clip_speed_base(clip_config, global_speed)
|
||||
|
||||
|
||||
# ── 向后兼容:模块级函数(重构前的 API) ─────────────────────────
|
||||
def build_video_filter(config):
|
||||
"""向后兼容:模块级 build_video_filter."""
|
||||
return _build_video_filter_base(config)
|
||||
|
||||
|
||||
def build_audio_filter(config):
|
||||
"""向后兼容:模块级 build_audio_filter."""
|
||||
return _build_audio_filter_base(config)
|
||||
|
||||
|
||||
def adjust_duration(original_duration, config):
|
||||
"""向后兼容:模块级 adjust_duration."""
|
||||
return _adjust_duration_base(original_duration, config)
|
||||
|
||||
|
||||
def resolve_clip_speed(clip_config, global_speed=DEFAULT_SPEED):
|
||||
"""向后兼容:模块级 resolve_clip_speed."""
|
||||
return _resolve_clip_speed_base(clip_config, global_speed)
|
||||
|
||||
|
||||
def build_clip_speed_filter(speed, pitch_correct=True):
|
||||
"""向后兼容:模块级 build_clip_speed_filter."""
|
||||
config = SpeedConfig(speed=speed, pitch_correct=pitch_correct)
|
||||
config.clamp()
|
||||
return (
|
||||
build_video_filter(config),
|
||||
build_audio_filter(config),
|
||||
config,
|
||||
)
|
||||
|
||||
@@ -26,6 +26,7 @@ from packages.domain.url_security import ALLOWED_AUDIO_MIME_TYPES as _allowed_au
|
||||
from packages.domain.url_security import ALLOWED_IMAGE_MIME_TYPES as _allowed_image_base
|
||||
from packages.domain.url_security import ALLOWED_PORTS as _allowed_ports_base
|
||||
from packages.domain.url_security import ALLOWED_SCHEMES as _allowed_schemes_base
|
||||
from packages.domain.url_security import ALLOWED_VIDEO_MIME_TYPES as _allowed_video_base
|
||||
from packages.domain.url_security import MAX_URL_LENGTH as _max_url_length_base
|
||||
from packages.domain.url_security import UrlSecurityError as _UrlSecurityError_base
|
||||
from packages.domain.url_security import check_internal_hostname as _check_internal_hostname_base
|
||||
@@ -42,6 +43,7 @@ ALLOWED_SCHEMES = set(_allowed_schemes_base)
|
||||
ALLOWED_PORTS = set(_allowed_ports_base)
|
||||
ALLOWED_AUDIO_MIME_TYPES = set(_allowed_audio_base)
|
||||
ALLOWED_IMAGE_MIME_TYPES = set(_allowed_image_base)
|
||||
ALLOWED_VIDEO_MIME_TYPES = set(_allowed_video_base)
|
||||
MAX_URL_LENGTH = _max_url_length_base
|
||||
UrlSecurityError = _UrlSecurityError_base
|
||||
|
||||
|
||||
@@ -102,3 +102,5 @@ ignore = [
|
||||
"apps/api/app/middleware/auth.py" = ["ALL"]
|
||||
"apps/*/migrations/*" = ["ALL"]
|
||||
"alembic/*" = ["ALL"]
|
||||
|
||||
"tests/**" = ["B011"]
|
||||
@@ -18,9 +18,9 @@ from packages.domain.classification import (
|
||||
class TestAssetLibraryKind:
|
||||
"""AssetLibraryKind 枚举测试."""
|
||||
|
||||
def test_two_values(self):
|
||||
"""视频和配音两类."""
|
||||
assert len(AssetLibraryKind) == 2
|
||||
def test_three_values(self):
|
||||
"""视频/配音/图片三类."""
|
||||
assert len(AssetLibraryKind) == 3
|
||||
|
||||
def test_video(self):
|
||||
assert AssetLibraryKind.VIDEO == "video"
|
||||
@@ -28,6 +28,9 @@ class TestAssetLibraryKind:
|
||||
def test_voice(self):
|
||||
assert AssetLibraryKind.VOICE == "voice"
|
||||
|
||||
def test_image(self):
|
||||
assert AssetLibraryKind.IMAGE == "image"
|
||||
|
||||
def test_str_compatible(self):
|
||||
"""StrEnum 字符串兼容."""
|
||||
assert AssetLibraryKind.VIDEO == "video"
|
||||
|
||||
@@ -468,7 +468,9 @@ class TestSubtitleStyle:
|
||||
assert style3.alignment == 5
|
||||
|
||||
def test_9grid_positions(self):
|
||||
from video_processing.subtitle_render_engine import POSITION_ALIGNMENT, SubtitleStyle
|
||||
from video_processing.subtitle_render_engine import SubtitleStyle
|
||||
|
||||
from packages.domain.subtitle_style import POSITION_ALIGNMENT
|
||||
|
||||
for pos, align in POSITION_ALIGNMENT.items():
|
||||
style = SubtitleStyle.from_dict({"position": pos})
|
||||
|
||||
Reference in New Issue
Block a user