From 00a2cfa079c1985e9c4529411c5463c32971d05a Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Sat, 24 Oct 2026 02:36:17 +0200 Subject: [PATCH] launch: a reason joined after 'The engine could not be installed.' starts with a capital; test --- strata_cli/launch/runner.py | 6 ++++++ tests/terminal/test_launch.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.py index c309ea0f..e3f7b92f 100644 --- a/strata_cli/launch/runner.py +++ b/strata_cli/launch/runner.py @@ -81,6 +81,11 @@ def missing_file(failure: str) -> bool: return failure.startswith(("ModuleNotFoundError", "ImportError", "FileNotFoundError")) +def capital(text: str) -> str: + """A reason that was written to stand alone ("the update feed could not be read: ...") starts the sentence it is joined to with a capital.""" + return text[:1].upper() + text[1:] + + class LaunchError(RuntimeError): """A step could not be done. `text` says what it means; `next` says what to do.""" @@ -615,6 +620,7 @@ class Runner: why = str(res["error"]) break why = why or (tail[-1] if tail else "") + why = capital(why) # (joined after a sentence: "the update feed could not be read ..." starts a new one) raise LaunchError("The engine could not be installed." + (f" {why}" if why else ""), "Check your internet connection, or point Strata at an update source with --feed, then try again.", 6) self.emit("engine", "The engine is installed.", 100) diff --git a/tests/terminal/test_launch.py b/tests/terminal/test_launch.py index 657a1cc4..bff3b199 100644 --- a/tests/terminal/test_launch.py +++ b/tests/terminal/test_launch.py @@ -970,6 +970,12 @@ class FlagsCommand(unittest.TestCase): self.assertEqual(code, 0) # the preset's own key self.assertTrue(out.strip().startswith("sk-strata-")) + def test_a_reason_joined_after_a_sentence_starts_with_a_capital(self): + from strata_cli.launch.runner import capital + self.assertEqual(capital("the update feed could not be read: no route"), "The update feed could not be read: no route") + self.assertEqual(capital("Already fine."), "Already fine.") + self.assertEqual(capital(""), "") + def test_launch_error_is_one_plain_sentence(self): from strata_cli.launch.runner import LaunchError with mock.patch.object(Runner, "run", side_effect=LaunchError("The engine could not be installed.", "Check your internet.", 6)):