refactor (untested)

This commit is contained in:
Mariano Gabriel
2026-06-28 21:12:13 -03:00
parent 5ea05eb553
commit cc64544d50
26 changed files with 540 additions and 340 deletions

55
tests/test_makefile.py Normal file
View File

@@ -0,0 +1,55 @@
"""Smoke for the Makefile wrapper: OUT defaults to IN, the baked-in FLAGS, and
the AUDIO_LANG knob (named to avoid the LANG locale env var)."""
import os
import shutil
import subprocess
import tempfile
import unittest
from pathlib import Path
from tests import REPO_ROOT
def make(target, **vars):
args = ["make", target] + [f"{k}={v}" for k, v in vars.items()]
return subprocess.run(args, cwd=REPO_ROOT, capture_output=True, text=True,
env=dict(os.environ))
@unittest.skipUnless(shutil.which("make"), "make not installed")
class TestMakefile(unittest.TestCase):
def test_dry_out_defaults_to_in(self):
with tempfile.TemporaryDirectory() as tmp:
ind = Path(tmp) / "in"
ind.mkdir()
(ind / "x.mp4").touch()
r = make("dry", IN=str(ind))
self.assertEqual(r.returncode, 0, r.stderr)
self.assertIn(f"Output: {ind}", r.stdout)
self.assertIn("Found 1 video", r.stdout)
def test_batch_baked_in_flags(self):
with tempfile.TemporaryDirectory() as tmp:
ind = Path(tmp) / "in"
ind.mkdir()
(ind / "x.mp4").touch()
r = make("batch", IN=str(ind), PYTHON="echo")
self.assertEqual(r.returncode, 0, r.stderr)
line = next(l for l in r.stdout.splitlines() if "process_meeting.py" in l)
self.assertIn("--scene-threshold 10", line)
self.assertIn("--transcript-formats srt", line)
self.assertIn("--embed-images", line)
self.assertNotIn("--language", line) # no AUDIO_LANG -> no --language
def test_audio_lang_appends_language(self):
with tempfile.TemporaryDirectory() as tmp:
ind = Path(tmp) / "in"
ind.mkdir()
(ind / "x.mp4").touch()
r = make("batch", IN=str(ind), PYTHON="echo", AUDIO_LANG="es")
self.assertEqual(r.returncode, 0, r.stderr)
self.assertIn("--language es", r.stdout)
if __name__ == "__main__":
unittest.main()