summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/test_ttk/test_extensions.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tkinter/test/test_ttk/test_extensions.py')
-rw-r--r--Lib/tkinter/test/test_ttk/test_extensions.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/tkinter/test/test_ttk/test_extensions.py
index 1a70e0b..e6b3ecc 100644
--- a/Lib/tkinter/test/test_ttk/test_extensions.py
+++ b/Lib/tkinter/test/test_ttk/test_extensions.py
@@ -2,7 +2,7 @@ import sys
import unittest
import tkinter
from tkinter import ttk
-from test.support import requires, run_unittest
+from test.support import requires, run_unittest, gc_collect
from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest
requires('gui')
@@ -18,6 +18,7 @@ class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
x = ttk.LabeledScale(self.root)
var = x._variable._name
x.destroy()
+ gc_collect() # For PyPy or other GCs.
self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var)
# manually created variable
@@ -30,6 +31,7 @@ class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
else:
self.assertEqual(float(x.tk.globalgetvar(name)), myvar.get())
del myvar
+ gc_collect() # For PyPy or other GCs.
self.assertRaises(tkinter.TclError, x.tk.globalgetvar, name)
# checking that the tracing callback is properly removed
@@ -171,6 +173,7 @@ class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
def test_resize(self):
x = ttk.LabeledScale(self.root)
x.pack(expand=True, fill='both')
+ gc_collect() # For PyPy or other GCs.
x.update()
width, height = x.master.winfo_width(), x.master.winfo_height()
@@ -206,6 +209,7 @@ class OptionMenuTest(AbstractTkTest, unittest.TestCase):
optmenu.destroy()
self.assertEqual(optmenu.tk.globalgetvar(name), var.get())
del var
+ gc_collect() # For PyPy or other GCs.
self.assertRaises(tkinter.TclError, optmenu.tk.globalgetvar, name)
@@ -251,6 +255,7 @@ class OptionMenuTest(AbstractTkTest, unittest.TestCase):
# check that variable is updated correctly
optmenu.pack()
+ gc_collect() # For PyPy or other GCs.
optmenu['menu'].invoke(0)
self.assertEqual(optmenu._variable.get(), items[0])