The setup window waits at most 1.5 seconds for the recorded paths

A recorded path on a disconnected network share can block its stat call. The paths load in a daemon thread and nothing is prefilled when it has not returned in time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-05 17:22:34 +03:00
1 parent a2843c3fbf
commit 23c278ef9f
2 files changed
+30 -1

No files matched your search

+16
View File
@@ -31,6 +31,10 @@ sys.path.insert(0, str(ROOT))
from installer import layout as layouts # noqa: E402
from installer import dpi # noqa: E402
from installer import recent # noqa: E402
try:
from installer import gui # noqa: E402
except ImportError: # no tkinter
gui = None
from installer import state as statefile # noqa: E402
from installer.events import Reporter # noqa: E402
from installer.runner import Context # noqa: E402
@@ -500,6 +504,18 @@ class RecentTest(unittest.TestCase):
self.file.write_text(text, encoding='utf-8')
self.assertEqual(recent.load(), {}, text)
@unittest.skipIf(gui is None, 'no tkinter')
def test_blocking_load_leaves_fields_empty(self):
with unittest.mock.patch.object(recent, 'load', side_effect=lambda: time.sleep(5) or {'dest': 'x'}):
start = time.monotonic()
self.assertEqual(gui.load_recent(0.3), {})
self.assertLess(time.monotonic() - start, 2)
@unittest.skipIf(gui is None, 'no tkinter')
def test_fast_load_is_returned(self):
with unittest.mock.patch.object(recent, 'load', return_value={'dest': 'x'}):
self.assertEqual(gui.load_recent(), {'dest': 'x'})
class SmokeTest(unittest.TestCase):
def test_every_screen_in_both_languages(self):