[Python-checkins] r69195 - in python/trunk/Lib/lib-tk/test/test_ttk: support.py test_extensions.py test_style.py test_widgets.py

guilherme.polo python-checkins at python.org
Mon Feb 2 01:38:54 CET 2009


Author: guilherme.polo
Date: Mon Feb  2 01:38:54 2009
New Revision: 69195

Log:
Use a single Tcl interpreter through all these tests, this may help some 
failing buildbots.


Modified:
   python/trunk/Lib/lib-tk/test/test_ttk/support.py
   python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py
   python/trunk/Lib/lib-tk/test/test_ttk/test_style.py
   python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py

Modified: python/trunk/Lib/lib-tk/test/test_ttk/support.py
==============================================================================
--- python/trunk/Lib/lib-tk/test/test_ttk/support.py	(original)
+++ python/trunk/Lib/lib-tk/test/test_ttk/support.py	Mon Feb  2 01:38:54 2009
@@ -15,6 +15,14 @@
 
     return root
 
+def root_deiconify():
+    root = get_tk_root()
+    root.deiconify()
+
+def root_withdraw():
+    root = get_tk_root()
+    root.withdraw()
+
 
 def simulate_mouse_click(widget, x, y):
     """Generate proper events to click at the x, y position (tries to act

Modified: python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py
==============================================================================
--- python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py	(original)
+++ python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py	Mon Feb  2 01:38:54 2009
@@ -10,6 +10,13 @@
 
 class LabeledScaleTest(unittest.TestCase):
 
+    def setUp(self):
+        support.root_deiconify()
+
+    def tearDown(self):
+        support.root_withdraw()
+
+
     def test_widget_destroy(self):
         # automatically created variable
         x = ttk.LabeledScale()
@@ -175,12 +182,12 @@
 class OptionMenuTest(unittest.TestCase):
 
     def setUp(self):
-        self.root = support.get_tk_root()
-        self.textvar = Tkinter.StringVar(self.root)
+        support.root_deiconify()
+        self.textvar = Tkinter.StringVar()
 
     def tearDown(self):
         del self.textvar
-        self.root.destroy()
+        support.root_withdraw()
 
 
     def test_widget_destroy(self):

Modified: python/trunk/Lib/lib-tk/test/test_ttk/test_style.py
==============================================================================
--- python/trunk/Lib/lib-tk/test/test_ttk/test_style.py	(original)
+++ python/trunk/Lib/lib-tk/test/test_ttk/test_style.py	Mon Feb  2 01:38:54 2009
@@ -10,15 +10,7 @@
 class StyleTest(unittest.TestCase):
 
     def setUp(self):
-        self.root = support.get_tk_root()
-        self.style = ttk.Style(self.root)
-
-    def tearDown(self):
-        # As tests have shown, these tests are likely to deliver
-        # <<ThemeChanged>> events after the root is destroyed, so
-        # lets let them happen now.
-        self.root.update_idletasks()
-        self.root.destroy()
+        self.style = ttk.Style()
 
 
     def test_configure(self):

Modified: python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py
==============================================================================
--- python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py	(original)
+++ python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py	Mon Feb  2 01:38:54 2009
@@ -12,12 +12,14 @@
     """Tests methods available in every ttk widget."""
 
     def setUp(self):
+        support.root_deiconify()
         self.widget = ttk.Button()
         self.widget.pack()
         self.widget.wait_visibility()
 
     def tearDown(self):
         self.widget.destroy()
+        support.root_withdraw()
 
 
     def test_identify(self):
@@ -107,10 +109,12 @@
 class ComboboxTest(unittest.TestCase):
 
     def setUp(self):
+        support.root_deiconify()
         self.combo = ttk.Combobox()
 
     def tearDown(self):
         self.combo.destroy()
+        support.root_withdraw()
 
     def _show_drop_down_listbox(self):
         width = self.combo.winfo_width()
@@ -195,10 +199,12 @@
 class EntryTest(unittest.TestCase):
 
     def setUp(self):
+        support.root_deiconify()
         self.entry = ttk.Entry()
 
     def tearDown(self):
         self.entry.destroy()
+        support.root_withdraw()
 
 
     def test_bbox(self):
@@ -297,10 +303,12 @@
 class PanedwindowTest(unittest.TestCase):
 
     def setUp(self):
+        support.root_deiconify()
         self.paned = ttk.Panedwindow()
 
     def tearDown(self):
         self.paned.destroy()
+        support.root_withdraw()
 
 
     def test_add(self):
@@ -445,12 +453,14 @@
 class ScaleTest(unittest.TestCase):
 
     def setUp(self):
+        support.root_deiconify()
         self.scale = ttk.Scale()
         self.scale.pack()
         self.scale.update()
 
     def tearDown(self):
         self.scale.destroy()
+        support.root_withdraw()
 
 
     def test_custom_event(self):
@@ -519,6 +529,7 @@
 class NotebookTest(unittest.TestCase):
 
     def setUp(self):
+        support.root_deiconify()
         self.nb = ttk.Notebook()
         self.child1 = ttk.Label()
         self.child2 = ttk.Label()
@@ -529,6 +540,7 @@
         self.child1.destroy()
         self.child2.destroy()
         self.nb.destroy()
+        support.root_withdraw()
 
 
     def test_tab_identifiers(self):
@@ -708,13 +720,12 @@
 class TreeviewTest(unittest.TestCase):
 
     def setUp(self):
-        self.root = support.get_tk_root()
-        self.tv = ttk.Treeview(self.root)
+        support.root_deiconify()
+        self.tv = ttk.Treeview()
 
     def tearDown(self):
         self.tv.destroy()
-        self.root.update_idletasks()
-        self.root.destroy()
+        support.root_withdraw()
 
 
     def test_bbox(self):


More information about the Python-checkins mailing list