Bring nine lessons from a client setup into the principles, the reviewers, larv-review and the project config
CI / tests (pull_request) Has been cancelled
CI / tests (pull_request) Has been cancelled
This commit is contained in:
@@ -410,6 +410,23 @@ class LoadTest(ConfigCase):
|
||||
(folder / "config.toml").write_text(CLIENT + 'touch-predictions = "docs/touch-predictions.md"\n', encoding="utf-8")
|
||||
self.assertIn("`touch-predictions` is 'docs/touch-predictions.md', not \"checkout:<path>\"", self.failure())
|
||||
|
||||
def test_coding_conventions_is_an_optional_list_of_paths_spelt_as_the_others_are(self) -> None:
|
||||
folder = self.write("acme", CLIENT)
|
||||
left_out = load(self.checkout, self.checkout, self.home)
|
||||
assert isinstance(left_out, ProjectConfig)
|
||||
self.assertEqual(left_out.coding_conventions, ())
|
||||
(folder / "config.toml").write_text(CLIENT + 'coding-conventions = ["checkout:CONVENTIONS.md", "folder:style.md", "~/shared/php.md"]\n', encoding="utf-8")
|
||||
found = load(self.checkout, self.checkout, self.home)
|
||||
assert isinstance(found, ProjectConfig)
|
||||
self.assertEqual(found.coding_conventions, (self.checkout / "CONVENTIONS.md", folder / "style.md", self.home / "shared/php.md"))
|
||||
|
||||
def test_coding_conventions_fails_where_it_is_not_a_list_or_one_of_its_paths_is_misspelt(self) -> None:
|
||||
folder = self.write("acme", CLIENT)
|
||||
for value, shown in (('"checkout:CONVENTIONS.md"', "'checkout:CONVENTIONS.md'"), ('["checkout:CONVENTIONS.md", "docs/style.md"]', "['checkout:CONVENTIONS.md', 'docs/style.md']"), ("[7]", "[7]")):
|
||||
with self.subTest(value=value):
|
||||
(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_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)
|
||||
@@ -526,7 +543,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, 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, 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)
|
||||
@@ -660,6 +677,16 @@ class ToolTest(ConfigCase):
|
||||
one = self.run_tool("changelog", cwd=self.checkout / "src")
|
||||
self.assertEqual((one.returncode, one.stdout), (0, f"{self.checkout}/CHANGELOG.md\n"))
|
||||
|
||||
def test_prints_the_coding_conventions_one_path_a_line_where_the_config_sets_them(self) -> None:
|
||||
folder = self.write("acme", CLIENT)
|
||||
unset = self.run_tool("coding-conventions")
|
||||
self.assertEqual((unset.returncode, unset.stdout, unset.stderr), (1, "", f"{folder / 'config.toml'} sets no `coding-conventions`\n"))
|
||||
self.assertNotIn("coding-conventions", self.run_tool().stdout)
|
||||
(folder / "config.toml").write_text(CLIENT + 'coding-conventions = ["checkout:CONVENTIONS.md", "folder:style.md"]\n')
|
||||
one = self.run_tool("coding-conventions")
|
||||
self.assertEqual((one.returncode, one.stdout), (0, f"{self.checkout}/CONVENTIONS.md\n{folder}/style.md\n"))
|
||||
self.assertIn(f"coding-conventions: {self.checkout}/CONVENTIONS.md, {folder}/style.md\n", self.run_tool().stdout)
|
||||
|
||||
def test_prints_the_env_file_where_the_config_sets_one_and_fails_asking_for_it_where_it_does_not(self) -> None:
|
||||
folder = self.write("acme", CLIENT)
|
||||
unset = self.run_tool("env-file")
|
||||
|
||||
Reference in New Issue
Block a user