test: add entry-point smoke tests

This commit is contained in:
Tiara Rodney 2026-06-16 20:15:20 +02:00
parent 4d1ec9e7fa
commit 0ea77d434f
Signed by: tiara
GPG key ID: 5CD8EC1D46106723

View file

@ -0,0 +1,30 @@
"""Smoke tests: the console entry points load and respond to --help without the
GPU stack (torch is imported lazily inside the training/eval code paths)."""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
SRC = ROOT / "src"
POSIX_SRC = ROOT.parent / "posix-sdc" / "src"
def _help(module: str) -> "subprocess.CompletedProcess[str]":
env = dict(os.environ, PYTHONPATH=os.pathsep.join([str(SRC), str(POSIX_SRC)]))
return subprocess.run([sys.executable, "-m", module, "--help"],
capture_output=True, text=True, env=env)
def test_train_help() -> None:
cp = _help("tiararodney.sekft.sft")
assert cp.returncode == 0, cp.stderr
assert "--data" in cp.stdout
def test_eval_help() -> None:
cp = _help("tiararodney.sekft.eval")
assert cp.returncode == 0, cp.stderr
assert "--adapter" in cp.stdout