Put the release's tools on PATH of every claude the loop starts, and name them bare in the prose
CI / tests (pull_request) Successful in 4m36s

This commit is contained in:
2026-12-03 12:49:56 +01:00
parent fb1dd763e2
commit 0653c2744e
64 changed files with 306 additions and 169 deletions
+24
View File
@@ -15,6 +15,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from loop_effects import child_shells
from failure import Failure
from loop_state.paths import RELEASE_ROOT
from loop_effects.effects import run_python, say, start_timer, StreamingClaude, system_effects
NOW = 1790000000
@@ -100,6 +101,25 @@ class ClaudeOnTerminal(unittest.TestCase):
def test_starts_claude_with_the_releases_tools_first_on_its_path(self):
with tempfile.TemporaryDirectory() as folder:
claude = pathlib.Path(folder, "claude")
claude.write_text('#!/bin/sh\necho "$PATH" > path\n')
claude.chmod(0o755)
system_effects(pathlib.Path.home(), os.environ).claude_on_terminal([], folder, {"PATH": f"{folder}:/usr/bin:/bin"})
self.assertEqual(pathlib.Path(folder, "path").read_text(), f"{RELEASE_ROOT}/bin:{folder}:/usr/bin:/bin\n")
class HeadlessClaude(unittest.TestCase):
def test_runs_claude_in_the_folder_with_its_input_and_the_releases_tools_first_on_its_path(self):
with tempfile.TemporaryDirectory() as folder:
claude = pathlib.Path(folder, "claude")
claude.write_text('#!/bin/sh\necho "$PWD $* $(cat) $PATH"\n')
claude.chmod(0o755)
done = system_effects(pathlib.Path.home(), os.environ | {"PATH": f"{folder}:/usr/bin:/bin"}).claude(["-p"], folder, "asked")
self.assertEqual(done.stdout, f"{os.path.realpath(folder)} -p asked {RELEASE_ROOT}/bin:{folder}:/usr/bin:/bin\n")
class ForgeEffect(unittest.TestCase):
def test_runs_the_forges_cli_in_the_checkout_it_is_given(self):
with tempfile.TemporaryDirectory() as folder:
@@ -325,6 +345,10 @@ class StreamingClaudeLines(unittest.TestCase):
os.close(each)
self.assertEqual(list(streaming.lines(5)), [f"{os.path.realpath(folder)} marked -p hi\n", "eof\n"])
def test_starts_claude_with_the_releases_tools_first_on_its_path(self):
streaming, folder = self.claude('echo "$PATH"')
self.assertEqual(list(streaming.lines(5)), [f"{RELEASE_ROOT}/bin:{folder}:{os.environ['PATH']}\n"])
def test_yields_none_whenever_the_idle_time_passes_without_a_line(self):
streaming, _ = self.claude("sleep 1; echo late")
seen = list(streaming.lines(0.1))