Answer principles round 1: 1 🔴, 7 🟡 (0 misread); every effect is handed in as an argument, no test patches a global, and the traces principle scopes tools that run on their user's machine
CI / tests (pull_request) Successful in 3m43s
CI / tests (pull_request) Successful in 3m43s
This commit is contained in:
@@ -9,6 +9,7 @@ from loop_effects.effects import Effects
|
||||
from claude_code import entries
|
||||
from failure import Failure
|
||||
from machine_load import memory
|
||||
from text_files.file_writes import replace_file
|
||||
from loop_effects.child_shells import Shell
|
||||
|
||||
|
||||
@@ -51,6 +52,8 @@ class FakeEffects:
|
||||
self.terminal_folders: list[str] = []
|
||||
# Each timer started, as its delay and action, which a test runs where the timer fires.
|
||||
self.timers: list[tuple[float, typing.Callable[[], None]]] = []
|
||||
# What writes a file: the real writer, until a test sets one that fails.
|
||||
self.replace_file: typing.Callable[[pathlib.Path, bytes], Failure | None] = replace_file
|
||||
|
||||
def effects(self) -> Effects:
|
||||
return Effects(
|
||||
@@ -66,6 +69,7 @@ class FakeEffects:
|
||||
now=lambda: NOW,
|
||||
on_terminal=lambda: self.terminal,
|
||||
python=lambda args, cwd: self.answer("python", (args, cwd)),
|
||||
replace_file=lambda path, data: self.replace_file(path, data),
|
||||
sleep=lambda seconds: self.calls.append(("sleep", seconds)),
|
||||
stream_claude=self.stream,
|
||||
timer=self.timer,
|
||||
|
||||
Reference in New Issue
Block a user