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:
@@ -5,7 +5,6 @@ import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import unittest.mock
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
@@ -36,11 +35,23 @@ class RouteSources(unittest.TestCase):
|
||||
# An item that left the plan, as once it shipped.
|
||||
self.assertIsNone(chunk_start.plan_item(plan, 999, FakeEffects().effects()))
|
||||
# A chunk start reads the default branch once, for routing and for scoring the items the worker names.
|
||||
with unittest.mock.patch.object(chunk_start, "session_open", return_value=True), unittest.mock.patch.object(chunk_start, "fetched_plan", return_value=plan) as fetched:
|
||||
loop = a_loop(FakeEffects().effects())
|
||||
self.assertEqual(chunk_start.chunk_start(loop), ("", plan))
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = configured(self, pathlib.Path(root))
|
||||
config = folder / "config.toml"
|
||||
config.write_text(config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
|
||||
(folder / "todo.md").write_text(TODO)
|
||||
opened = session.session_named("A proj loop-claude", pathlib.Path(root, "projects"))
|
||||
transcript = pathlib.Path(root, "projects", "-fake", f"{opened.id}.jsonl")
|
||||
transcript.parent.mkdir(parents=True)
|
||||
transcript.write_text("")
|
||||
unread = Failure("no git")
|
||||
fake = FakeEffects(git=["origin\n", "origin/main\n", unread, unread, unread, unread])
|
||||
with contextlib.redirect_stderr(io.StringIO()) as stderr:
|
||||
facts, held = chunk_start.chunk_start(a_loop(fake.effects(), root=root, session=opened, paths=paths.paths_from(folder.parents[1])))
|
||||
self.assertEqual((facts, held.plan), ("", plan_of(TODO)))
|
||||
self.assertEqual([args for args in fake.made("git") if args[0] == "remote"], [["remote"]])
|
||||
# An open session is no fresh chunk, so the human isn't told again of releases the plan cannot show.
|
||||
fetched.assert_called_once_with(loop, False)
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
unreadable = Failure("git show origin/main:todo.md printed text that is not UTF-8")
|
||||
for plan, said in ((DefaultPlan(plan_of(TODO.replace("| 4 | 2 | 3 |", "| x | 2 | 3 |")), NO_CUT), "routing on the project's rung: item 3's L 'x' is not a whole number from 1 to 4\n"), (DefaultPlan(unreadable, NO_CUT), f"routing on the project's rung: {unreadable.reason}\n"), (Failure("no origin remote"), "routing on the project's rung: no origin remote\n")):
|
||||
with self.subTest(said=said):
|
||||
|
||||
Reference in New Issue
Block a user