mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
bpo-42142: Try to fix timeouts in ttk tests (GH-23474)
Instead of using wait_visibility() which waits event <VisibilityNotify> in dead loop
use update() which should proceed all queued events.
(cherry picked from commit 6cc2c419f6
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
586bdd1add
commit
03ae7e4518
2 changed files with 7 additions and 19 deletions
|
@ -114,7 +114,6 @@ class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
|
|||
def test_horizontal_range(self):
|
||||
lscale = ttk.LabeledScale(self.root, from_=0, to=10)
|
||||
lscale.pack()
|
||||
lscale.wait_visibility()
|
||||
lscale.update()
|
||||
|
||||
linfo_1 = lscale.label.place_info()
|
||||
|
@ -144,7 +143,6 @@ class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
|
|||
def test_variable_change(self):
|
||||
x = ttk.LabeledScale(self.root)
|
||||
x.pack()
|
||||
x.wait_visibility()
|
||||
x.update()
|
||||
|
||||
curr_xcoord = x.scale.coords()[0]
|
||||
|
@ -187,7 +185,6 @@ class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
|
|||
def test_resize(self):
|
||||
x = ttk.LabeledScale(self.root)
|
||||
x.pack(expand=True, fill='both')
|
||||
x.wait_visibility()
|
||||
x.update()
|
||||
|
||||
width, height = x.master.winfo_width(), x.master.winfo_height()
|
||||
|
@ -268,7 +265,6 @@ class OptionMenuTest(AbstractTkTest, unittest.TestCase):
|
|||
|
||||
# check that variable is updated correctly
|
||||
optmenu.pack()
|
||||
optmenu.wait_visibility()
|
||||
optmenu['menu'].invoke(0)
|
||||
self.assertEqual(optmenu._variable.get(), items[0])
|
||||
|
||||
|
@ -299,9 +295,7 @@ class OptionMenuTest(AbstractTkTest, unittest.TestCase):
|
|||
textvar2 = tkinter.StringVar(self.root)
|
||||
optmenu2 = ttk.OptionMenu(self.root, textvar2, default, *items)
|
||||
optmenu.pack()
|
||||
optmenu.wait_visibility()
|
||||
optmenu2.pack()
|
||||
optmenu2.wait_visibility()
|
||||
optmenu['menu'].invoke(1)
|
||||
optmenu2['menu'].invoke(2)
|
||||
optmenu_stringvar_name = optmenu['menu'].entrycget(0, 'variable')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue