File size: 866 Bytes
f526878
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Lightweight smoke checks for BLUX-cA CLI surfaces."""
from __future__ import annotations

import subprocess
import sys
from pathlib import Path
from typing import List

ROOT = Path(__file__).resolve().parent.parent


def run(cmd: List[str]) -> int:
    print(f"\n$ {' '.join(cmd)}")
    result = subprocess.run(cmd, cwd=ROOT)
    if result.returncode != 0:
        print(f"Command failed with exit code {result.returncode}")
    return result.returncode


def main() -> int:
    failures = 0
    failures += run([sys.executable, "-m", "compileall", "train"])
    failures += run([sys.executable, "ca/cli.py", "--help"])
    failures += run([sys.executable, "ca/cli.py", "doctor", "--help"])
    failures += run([sys.executable, "ca/cli.py", "train", "validate", "--help"])
    return 1 if failures else 0


if __name__ == "__main__":
    raise SystemExit(main())