Test task-bench's docker calls, command line and planter where mutants survived
CI / tests (pull_request) Successful in 4m38s

This commit is contained in:
2026-11-21 01:39:12 +01:00
parent fed84cc510
commit ebbe926ab7
7 changed files with 316 additions and 35 deletions
+6 -6
View File
@@ -8,11 +8,11 @@ import shutil
import subprocess
import typing
from failure import Failure
from mutate_changes.changed_lines import is_test
from mutate_changes.tool_process import failed, Ran
from task_bench.api_proxy import PORT
from failure import Failure
from task_bench.figures import HOME, WORK
from mutate_changes.changed_lines import is_test
from task_bench.api_proxy import PORT
MODEL = "claude-haiku-5-5"
# No MCP server, skill, command or stored session, so a run starts from the code alone; -p needs --verbose with stream-json, and no
@@ -41,10 +41,10 @@ class Docker(typing.Protocol):
def __call__(self, args: list[str], *, seconds: float, stdin: str | None = None, stdout: typing.IO[bytes] | None = None, stderr: typing.IO[bytes] | None = None) -> Ran | Failure: ...
def docker_cli(env: typing.Mapping[str, str]) -> Docker:
def docker_cli(env: typing.Mapping[str, str], run: typing.Callable[..., subprocess.CompletedProcess[bytes]] = subprocess.run) -> Docker:
def docker(args: list[str], *, seconds: float, stdin: str | None = None, stdout: typing.IO[bytes] | None = None, stderr: typing.IO[bytes] | None = None) -> Ran | Failure:
try:
ran = subprocess.run(["docker", *args], env=env, input=None if stdin is None else stdin.encode(), stdin=subprocess.DEVNULL if stdin is None else None, stdout=stdout or subprocess.PIPE, stderr=stderr or subprocess.STDOUT, timeout=seconds, check=False)
ran = run(["docker", *args], env=env, input=None if stdin is None else stdin.encode(), stdin=subprocess.DEVNULL if stdin is None else None, stdout=stdout or subprocess.PIPE, stderr=stderr or subprocess.STDOUT, timeout=seconds, check=False)
except OSError as failure:
return Failure(f"docker could not start: {failure.strerror}")
except subprocess.TimeoutExpired:
@@ -105,7 +105,7 @@ def closed(containers: Containers) -> None:
containers.docker(args, seconds=120)
def tests_run(containers: Containers, tree: str) -> Ran | Failure:
def ran_tests(containers: Containers, tree: str) -> Ran | Failure:
"""The project's test command, run at the top of tree with no network; the tests pass where it exits 0. A Failure where it still
ran after RUN_SECONDS."""
ran = containers.docker(["run", "--rm", "--name", containers.running, "--network", "none", *in_tree(containers, tree), containers.image, "sh", "-c", containers.test], seconds=RUN_SECONDS)