Test that loop-claude starts no chunk where every item left awaits a person's merge
CI / tests (pull_request) Successful in 3m25s
CI / tests (pull_request) Successful in 3m25s
This commit is contained in:
@@ -9,7 +9,7 @@ import unittest
|
|||||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
|
||||||
|
|
||||||
from chunk_driver.doubles import a_loop
|
from chunk_driver.doubles import a_loop
|
||||||
from loop_claude.loop import chunk_start, chunk_windows
|
from loop_claude.loop import chunk_start, chunk_windows, reload
|
||||||
from project_config.doubles import configured
|
from project_config.doubles import configured
|
||||||
from release_plan.release_standing import DefaultPlan, LastCut, UNSEEN_RELEASES
|
from release_plan.release_standing import DefaultPlan, LastCut, UNSEEN_RELEASES
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
@@ -92,13 +92,15 @@ class RouteSources(unittest.TestCase):
|
|||||||
with tempfile.TemporaryDirectory() as root:
|
with tempfile.TemporaryDirectory() as root:
|
||||||
folder = configured(self, pathlib.Path(root))
|
folder = configured(self, pathlib.Path(root))
|
||||||
(folder / "config.toml").write_text((folder / "config.toml").read_text() + 'merge = "human"\n')
|
(folder / "config.toml").write_text((folder / "config.toml").read_text() + 'merge = "human"\n')
|
||||||
fake = FakeEffects(forge=[f"12\thttps://github.com/o/r/pull/12\t{head}\tfalse\tfalse\n"] * 2)
|
fake = FakeEffects(forge=[f"12\thttps://github.com/o/r/pull/12\t{head}\tfalse\tfalse\n"] * 3)
|
||||||
held = chunk_start.fetched_plan(a_loop(dataclasses.replace(fake.effects(), git=git), root=root, paths=paths.paths_from(folder.parents[1])))
|
held = chunk_start.fetched_plan(a_loop(dataclasses.replace(fake.effects(), git=git), root=root, paths=paths.paths_from(folder.parents[1])))
|
||||||
self.assertEqual([(item.id, item.awaits_merge) for item in held.plan.items], [(7, ""), (3, "#12 https://github.com/o/r/pull/12"), (1, "")])
|
self.assertEqual([(item.id, item.awaits_merge) for item in held.plan.items], [(7, ""), (3, "#12 https://github.com/o/r/pull/12"), (1, "")])
|
||||||
self.assertEqual(fake.made("forge")[0][:4], [root, "gh", "pr", "list"])
|
self.assertEqual(fake.made("forge")[0][:4], [root, "gh", "pr", "list"])
|
||||||
self.assertIsNone(chunk_start.plan_item(held, None, fake.effects()), "items 7 and 3 wait, so no item of the next release routes the chunk")
|
self.assertIsNone(chunk_start.plan_item(held, None, fake.effects()), "items 7 and 3 wait, so no item of the next release routes the chunk")
|
||||||
window = chunk_windows.next_plan(root, folder.parents[1], dataclasses.replace(fake.effects(), git=git))
|
window = chunk_windows.next_plan(root, folder.parents[1], dataclasses.replace(fake.effects(), git=git))
|
||||||
self.assertEqual((window.awaits_merge, fake.made("forge")[1][:4]), (True, [root, "gh", "pr", "list"]), "a window starts by the same pick")
|
self.assertEqual((window.awaits_merge, fake.made("forge")[1][:4]), (True, [root, "gh", "pr", "list"]), "a window starts by the same pick")
|
||||||
|
stopped = chunk_windows.chunks_to_start([], reload.LoopRun(1, root, "do it", ""), False, 1, paths.paths_from(folder.parents[1]), dataclasses.replace(fake.effects(), git=git))
|
||||||
|
self.assertEqual(stopped, Failure(window.why), "so the loop starts no chunk, and says which pull requests it waits on")
|
||||||
|
|
||||||
def test_reads_a_plan_outside_the_checkout_as_it_stands_and_stops_without_a_config(self):
|
def test_reads_a_plan_outside_the_checkout_as_it_stands_and_stops_without_a_config(self):
|
||||||
with tempfile.TemporaryDirectory() as root:
|
with tempfile.TemporaryDirectory() as root:
|
||||||
|
|||||||
Reference in New Issue
Block a user