diff --git a/bin/task_bench/figures/test_gather.py b/bin/task_bench/figures/test_gather.py index b1949c5d..5fb01110 100644 --- a/bin/task_bench/figures/test_gather.py +++ b/bin/task_bench/figures/test_gather.py @@ -148,6 +148,18 @@ class GatherTest(unittest.TestCase): self.assertEqual(errors.getvalue(), f"{self.bench} holds no digest: run task-bench in this checkout first.\n") +class OnceReady(unittest.TestCase): + def test_a_home_that_is_not_ready_gives_a_failed_run_that_says_why_on_stderr(self): + done = once_ready(lambda: "not signed in", lambda *_: self.fail("claude started"))(["-p"], "/checkout", "asked") + self.assertEqual((done.args, done.returncode, done.stdout, done.stderr), (["-p"], 1, "", "not signed in")) + + def test_a_ready_home_runs_claude_with_what_it_was_given(self): + ran = subprocess.CompletedProcess(["-p"], 0, "answered", "") + calls: list[tuple[list[str], str, str]] = [] + self.assertIs(once_ready(lambda: None, lambda *given: calls.append(given) or ran)(["-p"], "/checkout", "asked"), ran) + self.assertEqual(calls, [(["-p"], "/checkout", "asked")]) + + class RunClaude(unittest.TestCase): def test_runs_claude_in_the_loops_claude_home_once_it_is_built_with_the_prompt_and_the_releases_tools_first_on_its_path(self): with tempfile.TemporaryDirectory() as folder: