"""Release gate: the whole pipeline (synthetic bars -> grids -> baselines -> MRPT -> scores -> tables) runs end to end on license-free data. Marked slow (~3 min on an M-series laptop).""" import json import subprocess import sys from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] @pytest.mark.slow def test_synthetic_pipeline(tmp_path): cache = tmp_path / "cache" r = subprocess.run([sys.executable, str(ROOT / "scripts" / "make_synthetic.py"), "--cache", str(cache), "--n", "3", "--end", "2024-04-30"], capture_output=True, text=True, cwd=ROOT) assert r.returncode == 0, r.stderr[-2000:] cfg = (ROOT / "configs" / "synthetic_smoke.yaml").read_text() cfg = cfg.replace('train_end: "2024-04-05", val_end: "2024-04-30", test_end: "2024-05-31"', 'train_end: "2024-03-15", val_end: "2024-04-05", test_end: "2024-04-30"') cfg = cfg.replace("cache: data/synthetic/cache", f"cache: {cache}").replace('end: "2024-05-31"', 'end: "2024-04-30"') cfg = cfg.replace("max_steps: 60", "max_steps: 20").replace("name: synthetic_smoke", "name: synthetic_ci") cfg = cfg.replace(" - {name: mlp, kind: mlp}\n", "") cfg_path = tmp_path / "ci.yaml"; cfg_path.write_text(cfg) r = subprocess.run([sys.executable, str(ROOT / "scripts" / "run_experiment.py"), "--config", str(cfg_path), "--exp-name", "synthetic_ci"], capture_output=True, text=True, cwd=ROOT) assert r.returncode == 0, r.stderr[-3000:] out = ROOT / "results" / "metrics" / "synthetic_ci" lb = (out / "leaderboard_test.csv").read_text() assert "naive_rw" in lb and "mrpt_tiny" in lb and "lightgbm" in lb s = json.loads((out / "summary_mrpt_tiny_test.json").read_text()) assert all(0 < s[str(H)]["crps"] < 1 for H in (5, 15, 30, 60)) assert 0.3 < s["60"]["cov_80"] < 1.0 import shutil shutil.rmtree(out, ignore_errors=True)