]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #27196: Stop 'application destroyed' warnings when running IDLE tests.
authorTerry Jan Reedy <tjreedy@udel.edu>
Sat, 4 Jun 2016 03:53:56 +0000 (23:53 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Sat, 4 Jun 2016 03:53:56 +0000 (23:53 -0400)
The update_idletasks solution was provided by Serhiy Storchaka.

Lib/idlelib/idle_test/README.txt
Lib/idlelib/idle_test/test_configdialog.py
Lib/idlelib/idle_test/test_parenmatch.py
Lib/idlelib/idle_test/test_textview.py
Lib/idlelib/idle_test/test_widgetredir.py

index 39a19d0bd0cda6fc89df3e424f98e1db579c9ca8..01b31f696b749ad39be3247297182776c32ab222 100644 (file)
@@ -71,9 +71,15 @@ deleted BEFORE root is destroyed.  See https://bugs.python.org/issue20567.
     @classmethod
     def tearDownClass(cls):
         del cls.text
+        cls.root.update_idletasks()
         cls.root.destroy()
         del cls.root
 
+The update_idletasks call is sometimes needed to prevent the following warning
+either when running a test alone or as part of the test suite (#27196).
+  can't invoke "event" command: application has been destroyed
+  ...
+  "ttk::ThemeChanged"
 
 Requires('gui') causes the test(s) it guards to be skipped if any of
 these conditions are met:
index fab860b43903c3186f340ee0b6883dd82ef76120..4b413e22ee0704b6b13558afa96c4fa31bc82aef 100644 (file)
@@ -1,7 +1,7 @@
-'''Unittests for idlelib/configHandler.py
-
-Coverage: 46% just by creating dialog. The other half is change code.
+'''Test idlelib.configHandler.
 
+Coverage: 46% just by creating dialog.
+The other half is code for working with user customizations.
 '''
 import unittest
 from test.support import requires
@@ -20,11 +20,12 @@ class ConfigDialogTest(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        cls.root.update_idletasks()
         cls.root.destroy()
         del cls.root
 
     def test_dialog(self):
-        d=ConfigDialog(self.root, 'Test', _utest=True)
+        d = ConfigDialog(self.root, 'Test', _utest=True)
         d.remove_var_callbacks()
         d.destroy()
 
index e15395261847f5cdd7061e4e3259f44418d0de4d..95cc22cf68c493c97d0f1f7a5825c90359089f80 100644 (file)
@@ -1,6 +1,8 @@
-"""Test idlelib.ParenMatch."""
-# This must currently be a gui test because ParenMatch methods use
-# several text methods not defined on idlelib.idle_test.mock_tk.Text.
+'''Test idlelib.ParenMatch.
+
+This must currently be a gui test because ParenMatch methods use
+several text methods not defined on idlelib.idle_test.mock_tk.Text.
+'''
 from test.support import requires
 requires('gui')
 
@@ -29,6 +31,7 @@ class ParenMatchTest(unittest.TestCase):
     @classmethod
     def tearDownClass(cls):
         del cls.text, cls.editwin
+        cls.root.update_idletasks()
         cls.root.destroy()
         del cls.root
 
index 1a75e95769ed10eeb7e8758d4289f3b07da3410f..02d1472240ee0c4e3c5db667786bd2fe06374814 100644 (file)
@@ -1,4 +1,4 @@
-'''Test the functions and main class method of textView.py.
+'''Test idlelib.textView.
 
 Since all methods and functions create (or destroy) a TextViewer, which
 is a widget containing multiple widgets, all tests must be gui tests.
@@ -24,6 +24,7 @@ def setUpModule():
 def tearDownModule():
     global root, TV
     del TV
+    root.update_idletasks()
     root.destroy()  # pyflakes falsely sees root as undefined
     del root
 
index eeec3ea34b1780df41f9fc93ced770536c764c6e..c68dfcc412413f01057aa8ef037dfaa86dbe13dc 100644 (file)
@@ -1,7 +1,7 @@
-"""Unittest for idlelib.WidgetRedirector
+'''Test idlelib.WidgetRedirector.
 
 100% coverage
-"""
+'''
 from test.support import requires
 import unittest
 from idlelib.idle_test.mock_idle import Func
@@ -49,6 +49,7 @@ class WidgetRedirectorTest(unittest.TestCase):
     @classmethod
     def tearDownClass(cls):
         del cls.text
+        cls.root.update_idletasks()
         cls.root.destroy()
         del cls.root