The update_idletasks solution was provided by Serhiy Storchaka.
@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:
-'''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
@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()
-"""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')
@classmethod
def tearDownClass(cls):
del cls.text, cls.editwin
+ cls.root.update_idletasks()
cls.root.destroy()
del cls.root
-'''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.
def tearDownModule():
global root, TV
del TV
+ root.update_idletasks()
root.destroy() # pyflakes falsely sees root as undefined
del root
-"""Unittest for idlelib.WidgetRedirector
+'''Test idlelib.WidgetRedirector.
100% coverage
-"""
+'''
from test.support import requires
import unittest
from idlelib.idle_test.mock_idle import Func
@classmethod
def tearDownClass(cls):
del cls.text
+ cls.root.update_idletasks()
cls.root.destroy()
del cls.root