"""Launch a built executable headless, let it start up, and check it found ffmpeg. python scripts/smoke_test.py dist/package/FFmpegWrapper/FFmpegWrapper[.exe] [shot.png] Exits non-zero if the app crashes, hangs, or reports that ffmpeg is missing. """ import os import subprocess import sys from pathlib import Path def main() -> None: exe = Path(sys.argv[1]).resolve() shot = Path(sys.argv[2] if len(sys.argv) > 2 else "smoke-test.png").resolve() shot.unlink(missing_ok=True) env = dict(os.environ, QT_QPA_PLATFORM="offscreen", FFWRAP_SMOKE_TEST=str(shot)) res = subprocess.run([str(exe)], env=env, timeout=180) if res.returncode != 0 or not shot.is_file(): sys.exit(f"Smoke test failed (exit code {res.returncode}, screenshot {'ok' if shot.is_file() else 'missing'})") print(f"Smoke test passed; screenshot saved to {shot}") if __name__ == "__main__": main()