This commit is contained in:
parent
5c9724de45
commit
994b2daf1f
4 changed files with 37 additions and 20 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue