From 1c01ed05f89842e2847515d86ba807b3854f8620 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:12:19 +0200 Subject: [PATCH] fix: keep the crash test's work folder in tmp --- tests/test_install_tui.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index 64202553..d94142d5 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -1217,7 +1217,10 @@ class CleanupSurvivesABrokenTerminal(unittest.TestCase): CleanupSurvivesABrokenTerminal.Tty.broken = True self.addCleanup(setattr, CleanupSurvivesABrokenTerminal.Tty, "broken", False) + work = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp")) + self.addCleanup(shutil.rmtree, work, True) with mock.patch.object(install._TuiTerminal, "draw", breaking_draw), \ + mock.patch.object(install.tempfile, "mkdtemp", return_value=str(work)), \ mock.patch.object(install, "tui_start", return_value=(fresh_state(), [])), \ mock.patch.object(install, "_open_local_sources"), \ mock.patch.object(install, "detect_os", return_value="linux"), \ @@ -1226,6 +1229,8 @@ class CleanupSurvivesABrokenTerminal(unittest.TestCase): code = install.run_tui(_args()) self.assertIs(sys.stdout, tty) self.assertEqual(code, 1) + # The crash keeps its log, and nothing else of the run. + self.assertEqual(sorted(path.name for path in work.iterdir()), ["error.log"]) self.assertEqual(termios.tcgetattr(slave), before) for number, handler in handlers.items(): self.assertEqual(signal.getsignal(number), handler)