30 lines
945 B
Python
30 lines
945 B
Python
"""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
|