Add the project setting merge = "human", under which chunk-pr merge leaves the pull request ready and a do-epic chunk parks on your merge

This commit is contained in:
Lilleman
2026-11-19 15:51:44 +01:00
parent 017cf33611
commit e2f5661760
15 changed files with 240 additions and 58 deletions
+30 -1
View File
@@ -390,6 +390,27 @@ class LoadTest(ConfigCase):
(folder / "config.toml").write_text(CLIENT + f"coding-conventions = {value}\n", encoding="utf-8")
self.assertIn(f"`coding-conventions` is {shown}, not a list of paths, each \"checkout:<path>\"", self.failure())
def test_merge_is_chunk_where_left_out_and_takes_human(self) -> None:
folder = self.write("acme", CLIENT)
left_out = load(self.checkout, self.checkout, self.home)
assert isinstance(left_out, ProjectConfig), left_out
self.assertEqual(left_out.merge, "chunk")
for spelled in ("chunk", "human"):
with self.subTest(spelled):
(folder / "config.toml").write_text(CLIENT + f'merge = "{spelled}"\n')
found = load(self.checkout, self.checkout, self.home)
assert isinstance(found, ProjectConfig), found
self.assertEqual(found.merge, spelled)
def test_a_merge_that_is_neither_chunk_nor_human_fails_naming_it(self) -> None:
folder = self.write("acme", CLIENT)
for spelled in ('"person"', "true"):
with self.subTest(spelled):
(folder / "config.toml").write_text(CLIENT + f"merge = {spelled}\n")
found = load(self.checkout, self.checkout, self.home)
assert isinstance(found, Failure), found
self.assertIn(f'`merge` is {spelled.strip(chr(34)) if spelled == "true" else repr(spelled.strip(chr(34)))}, not "chunk" or "human"'.replace("true", "True"), found.reason)
def test_wait_for_approval_is_an_optional_boolean_that_is_false_where_left_out(self) -> None:
folder = self.write("acme", CLIENT)
left_out = load(self.checkout, self.checkout, self.home)
@@ -506,7 +527,7 @@ class LoadTest(ConfigCase):
def test_the_failure_for_a_misplaced_env_file_and_a_missing_setting_names_both_and_lists_every_setting(self) -> None:
folder = self.write("acme", "".join(line + "\n" for line in CLIENT.splitlines() if not line.startswith("plan")) + 'env-file = "checkout:.env"\n')
self.assertEqual(self.failure(), f"{folder / 'config.toml'}: `plan` is missing; `env-file` is 'checkout:.env', not {OUTSIDE}. The settings are {', '.join(SETTINGS)}, and optionally branch, coding-conventions, commit-title, env-file, jira-finish-status, jira-finish-transition, jira-score-bar, jira-score-formula, language, notifier, parallel-chunks, pull-request-title, readability-floor, tooling-on-host, touch-predictions and wait-for-approval.")
self.assertEqual(self.failure(), f"{folder / 'config.toml'}: `plan` is missing; `env-file` is 'checkout:.env', not {OUTSIDE}. The settings are {', '.join(SETTINGS)}, and optionally branch, coding-conventions, commit-title, env-file, jira-finish-status, jira-finish-transition, jira-score-bar, jira-score-formula, language, merge, notifier, parallel-chunks, pull-request-title, readability-floor, tooling-on-host, touch-predictions and wait-for-approval.")
def test_two_configs_naming_one_checkout_fail_naming_both(self) -> None:
self.write("acme", CLIENT)
@@ -685,6 +706,14 @@ class ToolTest(ConfigCase):
self.assertEqual((self.run_tool("jira-score-formula").stdout, self.run_tool("jira-score-bar").stdout), ("100 * V / (2**S + 8)\n", "0.5\n"))
self.assertIn("jira-score-formula: 100 * V / (2**S + 8)\njira-score-bar: 0.5\n", self.run_tool().stdout)
def test_prints_who_merges_and_lists_it_only_where_a_human_does(self) -> None:
folder = self.write("acme", CLIENT)
self.assertEqual(self.run_tool("merge").stdout, "chunk\n")
self.assertNotIn("merge", self.run_tool().stdout)
(folder / "config.toml").write_text(CLIENT + 'merge = "human"\n')
self.assertEqual(self.run_tool("merge").stdout, "human\n")
self.assertEqual(self.run_tool().stdout.splitlines()[-1], "merge: human")
def test_prints_true_or_false_for_wait_for_approval_and_lists_it_only_where_the_config_sets_it(self) -> None:
folder = self.write("acme", CLIENT)
left_out = self.run_tool("wait-for-approval")