test(tools): ffmpeg round-trip test skips when the ffmpeg on PATH cannot run

which("ffmpeg") is true on CI runners whose ffmpeg exits 127, so the "if
available" test failed on unrelated PRs (runs 35426109735, 35429954462).
Availability means the synthesis step succeeds; otherwise skip with the exit code.
This commit is contained in:
teknium1
2026-09-19 01:33:17 -07:00
committed by Teknium
parent 3752f89ff8
commit a05000810a

View File

@@ -67,13 +67,16 @@ class TestRepairOggContainer:
if not _shutil.which("ffmpeg"):
pytest.skip("ffmpeg not installed")
# Synthesize a real tiny mp3 with ffmpeg, misname it .ogg
# Synthesize a real tiny mp3 with ffmpeg, misname it .ogg. "Available" means the binary
# runs AND carries the encoder: CI runners have shipped an ffmpeg on PATH that exits 127.
p = tmp_path / "v.ogg"
_sp.run(
synth = _sp.run(
["ffmpeg", "-f", "lavfi", "-i", "sine=frequency=440:duration=0.3",
"-acodec", "libmp3lame", "-f", "mp3", str(p), "-y"],
capture_output=True, check=True,
capture_output=True, check=False,
)
if synth.returncode != 0:
pytest.skip(f"ffmpeg on PATH cannot synthesize mp3 (exit {synth.returncode})")
assert _sniff_audio_container(str(p)) == "mp3"
result = _repair_ogg_container(str(p))
assert result == str(p)