31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import os
|
|
import shutil
|
|
|
|
import pytest
|
|
|
|
requires_full = pytest.mark.skipif(
|
|
not os.environ.get("SONGTRACE_E2E"),
|
|
reason="set SONGTRACE_E2E=1 (needs GPU, ffmpeg, whisper server, network)")
|
|
|
|
@requires_full
|
|
def test_full_pipeline(tmp_path):
|
|
from songtrace.config import load_config
|
|
from songtrace.pipeline import SongInput, run_pipeline
|
|
assert shutil.which("ffmpeg"), "ffmpeg required"
|
|
cfg = load_config()
|
|
cfg.output_dir = tmp_path / "out"
|
|
cfg.work_dir = tmp_path / "work"
|
|
inp = SongInput(
|
|
title=os.environ["SONGTRACE_E2E_TITLE"],
|
|
artist=os.environ["SONGTRACE_E2E_ARTIST"],
|
|
lyrics_text=open(os.environ["SONGTRACE_E2E_LYRICS"]).read(),
|
|
youtube_url=os.environ.get("SONGTRACE_E2E_URL"),
|
|
)
|
|
result = run_pipeline(inp, cfg)
|
|
txts = list(result.output_dir.glob("*.txt"))
|
|
assert len(txts) == 1
|
|
from songtrace.ultrastar import get_header, parse_ultrastar
|
|
song = parse_ultrastar(txts[0].read_text(encoding="utf-8"))
|
|
assert get_header(song, "BPM") and get_header(song, "GAP")
|
|
assert len(song.body) > 20
|