test: isolate git identity in CI
All checks were successful
ci / validate (push) Successful in 2m3s

This commit is contained in:
tegwick 2026-08-21 10:56:14 +02:00
parent 5c9724de45
commit 994b2daf1f
4 changed files with 37 additions and 20 deletions

View file

@ -11,6 +11,18 @@ from glas_harness.reins.rein_aharness import ReinAharness, ReinAharnessNotInstal
from glas_harness.transport import ExecutionTransport, TransportError
def _init_repo(repo) -> None:
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
subprocess.run(["git", "config", "user.name", "Glas Harness Tests"], cwd=repo, check=True)
subprocess.run(
["git", "config", "user.email", "glas-harness-tests@example.invalid"],
cwd=repo,
check=True,
)
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "init"], cwd=repo, check=True)
def test_is_rein_subclass() -> None:
assert issubclass(ReinAharness, Rein)
@ -25,9 +37,7 @@ def test_bin_raises_if_not_installed() -> None:
def test_start_session_writes_task_file_and_captures_head(tmp_path) -> None:
repo = tmp_path / "repo"
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "init"], cwd=repo, check=True)
_init_repo(repo)
rein = ReinAharness()
sandbox = SandboxHandle(
@ -97,9 +107,7 @@ def test_dispatch_tool_reports_failure() -> None:
def test_end_session_detects_new_commit(tmp_path) -> None:
repo = tmp_path / "repo"
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "init"], cwd=repo, check=True)
_init_repo(repo)
rein = ReinAharness()
head_before = subprocess.run(
@ -126,9 +134,7 @@ def test_end_session_detects_new_commit(tmp_path) -> None:
def test_end_session_no_new_commit(tmp_path) -> None:
repo = tmp_path / "repo"
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "init"], cwd=repo, check=True)
_init_repo(repo)
rein = ReinAharness()
head = subprocess.run(

View file

@ -11,6 +11,18 @@ from glas_harness.reins.rein_openweights import ReinOpenWeights, ReinOpenWeights
from glas_harness.transport import ExecutionTransport, TransportError
def _init_repo(repo) -> None:
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
subprocess.run(["git", "config", "user.name", "Glas Harness Tests"], cwd=repo, check=True)
subprocess.run(
["git", "config", "user.email", "glas-harness-tests@example.invalid"],
cwd=repo,
check=True,
)
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "init"], cwd=repo, check=True)
def test_is_rein_subclass() -> None:
assert issubclass(ReinOpenWeights, Rein)
@ -25,9 +37,7 @@ def test_bin_raises_if_not_installed() -> None:
def test_start_session_writes_task_file_and_captures_head(tmp_path) -> None:
repo = tmp_path / "repo"
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "init"], cwd=repo, check=True)
_init_repo(repo)
rein = ReinOpenWeights()
sandbox = SandboxHandle(
@ -129,9 +139,7 @@ def test_dispatch_tool_enforces_outer_timeout() -> None:
def test_end_session_detects_new_commit(tmp_path) -> None:
repo = tmp_path / "repo"
repo.mkdir()
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", "init"], cwd=repo, check=True)
_init_repo(repo)
rein = ReinOpenWeights()
head_before = subprocess.run(