]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-69134: Wait until mapped in keyboard virtual-event tests (GH-152599) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 29 Jun 2026 17:31:58 +0000 (19:31 +0200)
committerGitHub <noreply@github.com>
Mon, 29 Jun 2026 17:31:58 +0000 (17:31 +0000)
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 be4eebb8386d07f360dd835a0ecb4a1eb6385736)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Lib/test/test_tkinter/test_widgets.py
Lib/test/test_ttk/test_widgets.py

index f5481e7712dad4ff6b8bb6a2e6dcb16c17f8b589..efd9beed71a88bb0ebc49c402b6a0e090b895b92 100644 (file)
@@ -1934,7 +1934,7 @@ class ListboxTest(AbstractWidgetTest, unittest.TestCase):
         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()
index 5c50fb659d47dec2a2ad48d30ab9e7905d7c8ecb..5b1000b699e4b0bcf9921c1f5a958983f3d6d97a 100644 (file)
@@ -1977,7 +1977,7 @@ class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
         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()))