Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-69134: Wait until mapped in keyboard virtual-event tests (GH-152599)
test_virtual_events and test_selection_event 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.  Wait until the
widget is mapped, as the other GUI tests already do.
(cherry picked from commit be4eebb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
  • Loading branch information
2 people authored and miss-islington committed Jun 29, 2026
commit 21f9c628f28952683f35fba2e7cadbc1e0c4d0c0
2 changes: 1 addition & 1 deletion Lib/test/test_tkinter/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ def test_selection_event(self):
lb = self.create(selectmode='browse', exportselection=False)
lb.insert(0, *('el%d' % i for i in range(5)))
lb.pack()
lb.update()
self.require_mapped(lb)
events = []
lb.bind('<<ListboxSelect>>', lambda e: events.append(lb.curselection()))
lb.focus_force()
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ttk/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ def test_virtual_events(self):
self.tv.insert(parent, 'end')
item2 = self.tv.insert('', 'end')
self.tv.pack()
self.tv.update()
self.require_mapped(self.tv)
selects, opens, closes = [], [], []
self.tv.bind('<<TreeviewSelect>>',
lambda e: selects.append(self.tv.selection()))
Expand Down
Loading