From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:54:13 +0000 (+0200) Subject: [3.13] gh-69134: Wait until mapped in keyboard virtual-event tests (GH-152599) (GH... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b066cd56c2575157bc76659b11b969553070eb1b;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-69134: Wait until mapped in keyboard virtual-event tests (GH-152599) (GH-152607) 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 Co-authored-by: Claude Opus 4.8 --- diff --git a/Lib/test/test_tkinter/test_widgets.py b/Lib/test/test_tkinter/test_widgets.py index 2535daed9773..4f37ceccbc56 100644 --- a/Lib/test/test_tkinter/test_widgets.py +++ b/Lib/test/test_tkinter/test_widgets.py @@ -1845,7 +1845,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('<>', lambda e: events.append(lb.curselection())) lb.focus_force() diff --git a/Lib/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py index a6e9303e06d2..5054ad8b9adf 100644 --- a/Lib/test/test_ttk/test_widgets.py +++ b/Lib/test/test_ttk/test_widgets.py @@ -1942,7 +1942,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('<>', lambda e: selects.append(self.tv.selection()))