fix: ask folder questions through one reader

The copy question, the card question and the BIOS folder question each
read q, Enter, a listed number or a folder. With no drive listed, the
copy question took "2" as the folder ./2. They share one reader now,
and the y/N questions read only y or yes: "yeah" created folders.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:04:39 +01:00
1 parent 1f215f1732
commit 7b89a558ff
10 files changed
+127 -130

No files matched your search

+6
View File
@@ -577,6 +577,12 @@ class AMissingDestIsSaid(unittest.TestCase):
self.assertFalse((root / "retroarh").exists())
self.assertEqual(self._call(dest, True, "y")[1], None)
def test_only_y_or_yes_creates_the_folders(self):
# A default-no question read "yeah" as yes, as no other one does.
root = Path(_tempdir(self))
self.assertEqual(self._call(root / "a" / "b", True, "yeah")[1], 2)
self.assertFalse((root / "a").exists())
def test_one_missing_level_or_no_terminal_is_said_not_asked(self):
root = Path(_tempdir(self))
# A "no" that was asked would stop the run with 2. Said with
+9
View File
@@ -8385,6 +8385,15 @@ class LineModeAndScreenDecideAlike(_LineModeFindings, _OutsideTextFindings,
self.assertIn("Type 1, a folder, or Enter.", out.getvalue())
self.assertNotIn("does not exist", out.getvalue())
def test_a_number_with_no_drive_listed_is_said_as_one(self):
# With no drive listed, "2" was read as the folder ./2.
with mock.patch.object(install, "_mounted_cards", return_value=[]), \
mock.patch.object(install, "_ask", side_effect=["2", ""]), \
contextlib.redirect_stdout(io.StringIO()) as out:
install._ask_from_folder([], self.here)
self.assertIn("Type a folder, or Enter.", out.getvalue())
self.assertNotIn("does not exist", out.getvalue())
def test_the_copy_line_names_the_folder_it_copies_from(self):
payload = b"gba"
files = [self.entry("gba_bios.bin", payload, ["nintendo-gba"])]