fix: let q decline the download confirmation

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 15:35:45 +02:00
1 parent eead810015
commit a56ab2a6b7
4 files changed
+22 -4

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ param(
$ErrorActionPreference = "Stop"
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
$defaultInstallSha256 = "6622a88280f46e21e7fac0adce72973211461cb6dc4af9cd3c5c1be8dd3aa842"
$defaultInstallSha256 = "8cf8886b8332714c2a2bc690a831fa2dd4b42f6b9c19df63bc002383b3650c2e"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+7 -2
View File
@@ -2562,9 +2562,14 @@ def installer_id() -> str:
return "unknown"
# Answers that stop: every menu before this one taught q as quit.
_REFUSALS = ("n", "q", "quit", "exit", "stop", "abort")
def _confirm(prompt: str) -> bool:
"""Yes unless the answer starts with n."""
return not _ask(prompt).lower().startswith("n")
"""Yes unless the answer refuses: n, no, or one of the quit words."""
answer = _ask(prompt).strip().lower()
return not (answer.startswith("n") or answer in _REFUSALS)
def _print_plan(to_download: list[dict], bios_path: Path, term: Terminal) -> None:
+1 -1
View File
@@ -18,7 +18,7 @@ esac
TEMP_INSTALLER=""
TEMP_DIRECTORY=""
DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
DEFAULT_INSTALL_SHA256="6622a88280f46e21e7fac0adce72973211461cb6dc4af9cd3c5c1be8dd3aa842"
DEFAULT_INSTALL_SHA256="8cf8886b8332714c2a2bc690a831fa2dd4b42f6b9c19df63bc002383b3650c2e"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+13
View File
@@ -2433,5 +2433,18 @@ class RetroArchUwpIsFound(unittest.TestCase):
self.assertIsNone(install._retroarch_uwp_system_dir())
class QuitMeansNoAtTheLastQuestion(unittest.TestCase):
"""Every menu taught q as quit; at "Download 3.2 GB ...? [Y/n]" a q
started the download."""
def test_quit_words_refuse(self):
for answer, expected in (("q", False), ("quit", False), ("exit", False),
("n", False), ("No", False), ("", True), ("y", True)):
with self.subTest(answer=answer), \
unittest.mock.patch.object(install, "_ask", return_value=answer):
self.assertIs(install._confirm("? "), expected)
if __name__ == "__main__":
unittest.main()