changeset: 101677:0207c6203f84 branch: 3.5 parent: 101675:813bb6a4c693 user: Terry Jan Reedy date: Fri Jun 03 23:53:56 2016 -0400 files: 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 description: Issue #27196: Stop 'application destroyed' warnings when running IDLE tests. The update_idletasks solution was provided by Serhiy Storchaka. diff -r 813bb6a4c693 -r 0207c6203f84 Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt Fri Jun 03 22:19:17 2016 -0400 +++ b/Lib/idlelib/idle_test/README.txt Fri Jun 03 23:53:56 2016 -0400 @@ -71,9 +71,15 @@ @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: diff -r 813bb6a4c693 -r 0207c6203f84 Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py Fri Jun 03 22:19:17 2016 -0400 +++ b/Lib/idlelib/idle_test/test_configdialog.py Fri Jun 03 23:53:56 2016 -0400 @@ -1,7 +1,7 @@ -'''Unittests for idlelib/configHandler.py +'''Test idlelib.configHandler. -Coverage: 46% just by creating dialog. The other half is change code. - +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 @@ @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() diff -r 813bb6a4c693 -r 0207c6203f84 Lib/idlelib/idle_test/test_parenmatch.py --- a/Lib/idlelib/idle_test/test_parenmatch.py Fri Jun 03 22:19:17 2016 -0400 +++ b/Lib/idlelib/idle_test/test_parenmatch.py Fri Jun 03 23:53:56 2016 -0400 @@ -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 @@ @classmethod def tearDownClass(cls): del cls.text, cls.editwin + cls.root.update_idletasks() cls.root.destroy() del cls.root diff -r 813bb6a4c693 -r 0207c6203f84 Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py Fri Jun 03 22:19:17 2016 -0400 +++ b/Lib/idlelib/idle_test/test_textview.py Fri Jun 03 23:53:56 2016 -0400 @@ -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 tearDownModule(): global root, TV del TV + root.update_idletasks() root.destroy() # pyflakes falsely sees root as undefined del root diff -r 813bb6a4c693 -r 0207c6203f84 Lib/idlelib/idle_test/test_widgetredir.py --- a/Lib/idlelib/idle_test/test_widgetredir.py Fri Jun 03 22:19:17 2016 -0400 +++ b/Lib/idlelib/idle_test/test_widgetredir.py Fri Jun 03 23:53:56 2016 -0400 @@ -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 @@ @classmethod def tearDownClass(cls): del cls.text + cls.root.update_idletasks() cls.root.destroy() del cls.root