Skip to content

Commit f269c6d

Browse files
committed
fix(tests): skip ffmpeg-dependent tests when binary is missing
The CI runner doesn't have ffmpeg installed. Tests that generate silent audio or compose video+audio are now marked requires_ffmpeg and skipped gracefully in that environment. Made-with: Cursor
1 parent b580fc3 commit f269c6d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/test_validate.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from __future__ import annotations
88

9+
import shutil
910
import subprocess
1011
from pathlib import Path
1112

@@ -18,6 +19,9 @@
1819
from docgen.config import Config
1920
from docgen.validate import Validator, _sample_frames
2021

22+
_has_ffmpeg = shutil.which("ffmpeg") is not None
23+
requires_ffmpeg = pytest.mark.skipif(not _has_ffmpeg, reason="ffmpeg not installed")
24+
2125

2226
# ── Helpers: create synthetic test videos ─────────────────────────────
2327

@@ -252,6 +256,7 @@ def test_check_freeze_ratio_math(self, config):
252256
assert c.check_freeze_ratio(100.0, 0.0) == pytest.approx(1.0)
253257
assert c.check_freeze_ratio(0.0, 50.0) == pytest.approx(0.0)
254258

259+
@requires_ffmpeg
255260
def test_compose_rejects_short_video(self, config, cfg_dir):
256261
"""Compose in strict mode should raise when video is way shorter than audio."""
257262
audio = cfg_dir / "audio" / "01-test.mp3"
@@ -264,6 +269,7 @@ def test_compose_rejects_short_video(self, config, cfg_dir):
264269
with pytest.raises(ComposeError, match="FREEZE GUARD"):
265270
c._compose_simple("01", video, strict=True)
266271

272+
@requires_ffmpeg
267273
def test_compose_allows_matching_durations(self, config, cfg_dir):
268274
"""Compose should succeed when video roughly matches audio."""
269275
audio = cfg_dir / "audio" / "01-test.mp3"
@@ -276,6 +282,7 @@ def test_compose_allows_matching_durations(self, config, cfg_dir):
276282
result = c._compose_simple("01", video, strict=True)
277283
assert result is True
278284

285+
@requires_ffmpeg
279286
def test_compose_nonstrict_warns(self, config, cfg_dir, capsys):
280287
"""Non-strict mode prints a warning but doesn't raise."""
281288
audio = cfg_dir / "audio" / "01-test.mp3"
@@ -329,6 +336,7 @@ def test_half_black_fails_pre_push(self, config, cfg_dir):
329336
with pytest.raises(SystemExit):
330337
v.run_pre_push()
331338

339+
@requires_ffmpeg
332340
def test_static_video_does_not_fail_pre_push(self, config, cfg_dir):
333341
"""freeze_ratio is a soft check — static (non-black) video only warns."""
334342
vid = cfg_dir / "recordings" / "01-test.mp4"

0 commit comments

Comments
 (0)