rein-aharness/tests/test_smoke.py

32 lines
967 B
Python
Raw Normal View History

from __future__ import annotations
import subprocess
from pathlib import Path
from rein_aharness.smoke import run_smoke
def _make_repo(tmp_path: Path) -> Path:
repo = tmp_path / "sandbox"
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
(repo / "README.md").write_text("sandbox\n")
subprocess.run(["git", "add", "."], cwd=repo, check=True)
subprocess.run(
["git", "-c", "user.email=t@t", "-c", "user.name=t", "commit", "-qm", "init"],
cwd=repo,
check=True,
)
return repo
def test_run_smoke_commits_without_push(tmp_path: Path) -> None:
repo = _make_repo(tmp_path)
result = run_smoke(repo, report_to_hub=False, push=False)
assert result.run.ok is True
assert result.run.committed is True
assert (repo / "SMOKE.md").is_file()
assert result.pushed is False
metrics = repo / ".kaizen" / "metrics" / "coach" / "executions.jsonl"
assert metrics.is_file()