47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_cli_runs_and_reports_metrics(tmp_path: Path) -> None:
|
|
result = subprocess.run(
|
|
[
|
|
sys.executable,
|
|
"-m",
|
|
"composer_ans",
|
|
"--thes-root",
|
|
str(ROOT / "THES"),
|
|
"--notes",
|
|
"4",
|
|
"--object-threshold",
|
|
"2",
|
|
"--max-attempts-per-note",
|
|
"600",
|
|
"--art-vigilance",
|
|
"0.85",
|
|
"--art-vigilance-decay",
|
|
"0.98",
|
|
"--save-salieri",
|
|
str(tmp_path / "salieri.json"),
|
|
"--save-beethoven",
|
|
str(tmp_path / "beethoven.json"),
|
|
"--save-report",
|
|
str(tmp_path / "report.json"),
|
|
],
|
|
cwd=ROOT,
|
|
text=True,
|
|
capture_output=True,
|
|
check=True,
|
|
)
|
|
|
|
assert "notes:" in result.stdout
|
|
assert "per_note_seconds:" in result.stdout
|
|
assert "total_seconds:" in result.stdout
|
|
assert "unigram_entropy_bits:" in result.stdout
|
|
assert (tmp_path / "salieri.json").exists()
|
|
assert (tmp_path / "beethoven.json").exists()
|
|
assert (tmp_path / "report.json").exists()
|