launch: a reason joined after 'The engine could not be installed.' starts with a capital; test

This commit is contained in:
Niko1221 committed 2026-10-24 02:36:17 +02:00
1 parent 6eaf32075c
commit 00a2cfa079
2 files changed
+12

No files matched your search

+6
View File
@@ -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)
+6
View File
@@ -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)):