Pass the shim folder into container_run so its test needs no built shim
CI / tests (pull_request) Successful in 2m59s

This commit is contained in:
2026-11-14 16:46:50 +01:00
parent 8a50a676a4
commit 4eed9114e5
2 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -71,8 +71,8 @@ def ensure_image(shim: pathlib.Path, run_docker: Docker = docker) -> str | Failu
return tag
def container_run(mode: str, text: str, run_docker: Docker = docker) -> Ran | Failure:
image = ensure_image(SHIM, run_docker)
def container_run(mode: str, text: str, run_docker: Docker = docker, shim: pathlib.Path = SHIM) -> Ran | Failure:
image = ensure_image(shim, run_docker)
if isinstance(image, Failure):
return image
return run_docker(docker_args(image, mode), text, RUN_SECONDS)
+5 -5
View File
@@ -178,15 +178,15 @@ def test_a_failure_to_start_docker_passes_through_inspect_and_build(tmp_path):
assert convert.ensure_image(tmp_path, scripted(convert.Ran(1, "", ""), down)) == down
def test_container_run_runs_the_image_on_the_text():
def test_container_run_runs_the_image_on_the_text(tmp_path):
run_docker = scripted(convert.Ran(0, "", ""), convert.Ran(0, "answer", ""))
assert convert.container_run("to-adf", "text", run_docker) == convert.Ran(0, "answer", "")
assert run_docker.lines[1] == (convert.docker_args(convert.image_tag(convert.SHIM), "to-adf"), "text", convert.RUN_SECONDS)
assert convert.container_run("to-adf", "text", run_docker, shim_dir(tmp_path)) == convert.Ran(0, "answer", "")
assert run_docker.lines[1] == (convert.docker_args(convert.image_tag(tmp_path), "to-adf"), "text", convert.RUN_SECONDS)
def test_container_run_passes_an_image_failure_through():
def test_container_run_passes_an_image_failure_through(tmp_path):
down = Failure("docker is not installed")
assert convert.container_run("to-adf", "text", scripted(down)) == down
assert convert.container_run("to-adf", "text", scripted(down), shim_dir(tmp_path)) == down
@pytest.mark.skipif(shutil.which("docker") is None or subprocess.run(["docker", "info"], capture_output=True).returncode != 0, reason="needs a docker daemon")