Skip to content

Commit 9fb01c8

Browse files
gh-69134: Wait until mapped in SimpleDialog keyboard tests
The SimpleDialog tests generate key events after focus_force(). On Windows these are only delivered once the toplevel is mapped, so they could be dropped and the test fail intermittently (seen on the Windows10 buildbot as test_return_no_default). Unlike the query dialogs, SimpleDialog only waits for its window in go(), which these tests bypass, so wait until it is mapped in the create() helper, as GH-152599 did for the other keyboard tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 38df997 commit 9fb01c8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/test/test_tkinter/test_simpledialog.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def create(self, **kw):
2323
kw.setdefault('cancel', 1)
2424
d = SimpleDialog(self.root, **kw)
2525
self.addCleanup(lambda: d.root.winfo_exists() and d.root.destroy())
26+
# Unlike the query dialogs, SimpleDialog only waits for the window to
27+
# appear in go(), which these tests bypass. On Windows the generated
28+
# key events are dropped until the toplevel is mapped (gh-69134), so
29+
# wait for it here.
30+
self.require_mapped(d.root)
2631
return d
2732

2833
# --- Widget set and appearance ---

0 commit comments

Comments
 (0)