diff --git a/tests/shared/test_alignment/test_alignment.py b/tests/shared/test_alignment/test_alignment.py index 1f3b2b5..3be109c 100644 --- a/tests/shared/test_alignment/test_alignment.py +++ b/tests/shared/test_alignment/test_alignment.py @@ -45,6 +45,12 @@ def _sample_dir() -> Path | None: return directory if directory.is_dir() else None +MEDIA_SUFFIXES = { + ".wav", ".mp3", ".flac", ".m4a", ".aac", ".ogg", + ".mp4", ".mkv", ".mov", ".webm", ".ts", +} + + @pytest.mark.integration def test_real_alignment_candidates_discovered() -> None: """对齐素材探查:能找到成对的媒体与参考字幕(数据契约可用)。""" @@ -52,6 +58,12 @@ def test_real_alignment_candidates_discovered() -> None: directory = _sample_dir() if directory is None: pytest.skip("缺少 tests/shared/data/alignment 目录") + # 真实媒体素材不入库(.gitignore 掉的 mp4/wav),没拷过素材属环境状态:跳过 + # 而不是失败;只要有一个媒体文件就说明素材已就位,此时配对不全才是真回归。 + has_media = any(p.is_file() and p.suffix.lower() in MEDIA_SUFFIXES + for p in directory.iterdir()) + if not has_media: + pytest.skip("缺少真实媒体素材(按需从媒体库复制,不入库)") # 测试过程 candidates = alignment_candidates(directory)