[Python-checkins] cpython (2.7): Issue #27922: IDLE tests no longer flash tk widgets.

terry.reedy python-checkins at python.org
Wed Aug 31 21:09:17 EDT 2016


https://hg.python.org/cpython/rev/bf0cb86c6219
changeset:   102981:bf0cb86c6219
branch:      2.7
parent:      102976:1f37903e6040
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Wed Aug 31 21:03:08 2016 -0400
summary:
  Issue #27922: IDLE tests no longer flash tk widgets.

files:
  Lib/idlelib/idle_test/test_configdialog.py |   1 +
  Lib/idlelib/idle_test/test_editmenu.py     |   1 +
  Lib/idlelib/idle_test/test_hyperparser.py  |   1 +
  Lib/idlelib/idle_test/test_textview.py     |  13 ++++++---
  Lib/idlelib/idle_test/test_widgetredir.py  |   2 +
  5 files changed, 13 insertions(+), 5 deletions(-)


diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -16,6 +16,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = Tk()
+        cls.root.withdraw()
         _initializeTkVariantTests(cls.root)
 
     @classmethod
diff --git a/Lib/idlelib/idle_test/test_editmenu.py b/Lib/idlelib/idle_test/test_editmenu.py
--- a/Lib/idlelib/idle_test/test_editmenu.py
+++ b/Lib/idlelib/idle_test/test_editmenu.py
@@ -18,6 +18,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = root = tk.Tk()
+        root.withdraw()
         PyShell.fix_x11_paste(root)
         cls.text = tk.Text(root)
         cls.entry = tk.Entry(root)
diff --git a/Lib/idlelib/idle_test/test_hyperparser.py b/Lib/idlelib/idle_test/test_hyperparser.py
--- a/Lib/idlelib/idle_test/test_hyperparser.py
+++ b/Lib/idlelib/idle_test/test_hyperparser.py
@@ -36,6 +36,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = Tk()
+        cls.root.withdraw()
         cls.text = Text(cls.root)
         cls.editwin = DummyEditwin(cls.text)
 
diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py
--- a/Lib/idlelib/idle_test/test_textview.py
+++ b/Lib/idlelib/idle_test/test_textview.py
@@ -9,7 +9,7 @@
 from idlelib.idle_test.mock_tk import Mbox
 
 
-class TV(tv.TextViewer):  # used by TextViewTest
+class TV(tv.TextViewer):  # Use in TextViewTest
     transient = Func()
     grab_set = Func()
     wait_window = Func()
@@ -20,6 +20,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = Tk()
+        cls.root.withdraw()
 
     @classmethod
     def tearDownClass(cls):
@@ -50,8 +51,8 @@
         view.destroy = Func()
         view.Ok()
         self.assertTrue(view.destroy.called)
-        del view.destroy  # unmask real function
-        view.destroy
+        del view.destroy  # Unmask the real function.
+        view.destroy()
 
 
 class ViewFunctionTest(unittest.TestCase):
@@ -60,6 +61,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = Tk()
+        cls.root.withdraw()
         cls.orig_mbox = tv.tkMessageBox
         tv.tkMessageBox = Mbox
 
@@ -71,9 +73,10 @@
         del cls.orig_mbox
 
     def test_view_text(self):
-        # If modal True, tkinter will error with 'can't invoke "event" command'
+        # If modal True, get tkinter error 'can't invoke "event" command'.
         view = tv.view_text(self.root, 'Title', 'test text', modal=False)
         self.assertIsInstance(view, tv.TextViewer)
+        view.Ok()
 
     def test_view_file(self):
         test_dir = os.path.dirname(__file__)
@@ -83,7 +86,7 @@
         self.assertIn('Test', view.textView.get('1.0', '1.end'))
         view.Ok()
 
-        # Mock messagebox will be used and view_file will not return anything
+        # Mock messagebox will be used; view_file will return None.
         testfile = os.path.join(test_dir, '../notthere.py')
         view = tv.view_file(self.root, 'Title', testfile, modal=False)
         self.assertIsNone(view)
diff --git a/Lib/idlelib/idle_test/test_widgetredir.py b/Lib/idlelib/idle_test/test_widgetredir.py
--- a/Lib/idlelib/idle_test/test_widgetredir.py
+++ b/Lib/idlelib/idle_test/test_widgetredir.py
@@ -15,6 +15,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = Tk()
+        cls.root.withdraw()
         cls.text = Text(cls.root)
 
     @classmethod
@@ -44,6 +45,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = Tk()
+        cls.root.withdraw()
         cls.text = Text(cls.root)
 
     @classmethod

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list