summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2013-07-28 20:39:44 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2013-07-28 20:39:44 (GMT)
commit015b4535c5cc9401adc72cafd4537152cee48e12 (patch)
tree4d6944314f87c7e0e3e37ac28055c9b02cefc996 /Lib
parenta9d16c85d79890f2d02ccc84da3960c2fdc08efb (diff)
downloadcpython-015b4535c5cc9401adc72cafd4537152cee48e12.zip
cpython-015b4535c5cc9401adc72cafd4537152cee48e12.tar.gz
cpython-015b4535c5cc9401adc72cafd4537152cee48e12.tar.bz2
Update gui section of idle test README.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/idle_test/README.txt16
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt
index b498e7c..a8d4dcb 100644
--- a/Lib/idlelib/idle_test/README.txt
+++ b/Lib/idlelib/idle_test/README.txt
@@ -40,13 +40,20 @@ master object either directly or indirectly by instantiating a tkinter or
idle class. For the benefit of buildbot machines that do not have a graphics
screen, gui tests must be 'guarded' by "requires('gui')" in a setUp
function or method. This will typically be setUpClass.
+
+All gui objects must be destroyed by the end of the test, perhaps in a tearDown
+function. Creating the Tk root directly in a setUp allows a reference to be saved
+so it can be properly destroyed in the corresponding tearDown.
---
@classmethod
def setUpClass(cls):
requires('gui')
+ cls.root = tk.Tk()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.root.destroy()
---
-All gui objects must be destroyed by the end of the test, perhaps in a tearDown
-function.
Support.requires('gui') returns true if it is either called in a main module
(which never happens on buildbots) or if use_resources contains 'gui'.
@@ -56,8 +63,9 @@ template above.
Since non-gui tests always run, but gui tests only sometimes, tests of non-gui
operations should best avoid needing a gui. Methods that make incidental use of
-tkinter variables and messageboxes can do this by using the mock classes in
-idle_test/mock_tk.py.
+tkinter (tk) variables and messageboxes can do this by using the mock classes in
+idle_test/mock_tk.py. There is also a mock text that will handle some uses of the
+tk Text widget.
3. Running Tests