test: add entry-point smoke tests
This commit is contained in:
parent
4d1ec9e7fa
commit
0ea77d434f
1 changed files with 30 additions and 0 deletions
30
tests/smoke/test_entrypoints.py
Normal file
30
tests/smoke/test_entrypoints.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue