summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-07-15 03:07:47 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-07-15 03:07:47 (GMT)
commit24fb2d4012d6bc89284f5160b7415e98d294d569 (patch)
treed76ce1a15599a1a511afeb85e2b740011e1832c8
parentbbbf45b08d49bd74341cccc24d8fe345cf1eea85 (diff)
parentcfa8950aaba03b1b3f6dc03e700f69edb88b1d67 (diff)
downloadcpython-24fb2d4012d6bc89284f5160b7415e98d294d569.zip
cpython-24fb2d4012d6bc89284f5160b7415e98d294d569.tar.gz
cpython-24fb2d4012d6bc89284f5160b7415e98d294d569.tar.bz2
Merge with 3.4
-rw-r--r--Lib/idlelib/configDialog.py14
-rw-r--r--Lib/idlelib/idle_test/test_configdialog.py32
2 files changed, 42 insertions, 4 deletions
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
index 72dd6b9..69dbebf 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -24,9 +24,10 @@ from idlelib import macosxSupport
class ConfigDialog(Toplevel):
- def __init__(self,parent,title,_htest=False):
+ def __init__(self, parent, title, _htest=False, _utest=False):
"""
_htest - bool, change box location when running htest
+ _utest - bool, don't wait_window when running unittest
"""
Toplevel.__init__(self, parent)
self.wm_withdraw()
@@ -69,8 +70,9 @@ class ConfigDialog(Toplevel):
self.LoadConfigs()
self.AttachVarCallbacks() #avoid callbacks during LoadConfigs
- self.wm_deiconify()
- self.wait_window()
+ if not _utest:
+ self.wm_deiconify()
+ self.wait_window()
def CreateWidgets(self):
self.tabPages = TabbedPageSet(self,
@@ -678,7 +680,7 @@ class ConfigDialog(Toplevel):
if self.listBindings.curselection():
reselect=1
listIndex=self.listBindings.index(ANCHOR)
- # keySet=idleConf.GetKeySet(keySetName) # unused, delete?
+ keySet=idleConf.GetKeySet(keySetName)
bindNames = list(keySet.keys())
bindNames.sort()
self.listBindings.delete(0,END)
@@ -1144,5 +1146,9 @@ class ConfigDialog(Toplevel):
pass
if __name__ == '__main__':
+ import unittest
+ unittest.main('idlelib.idle_test.test_configdialog',
+ verbosity=2, exit=False)
+
from idlelib.idle_test.htest import run
run(ConfigDialog)
diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
new file mode 100644
index 0000000..6883123
--- /dev/null
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -0,0 +1,32 @@
+'''Unittests for idlelib/configHandler.py
+
+Coverage: 46% just by creating dialog. The other half is change code.
+
+'''
+import unittest
+from test.support import requires
+from tkinter import Tk
+from idlelib.configDialog import ConfigDialog
+from idlelib.macosxSupport import _initializeTkVariantTests
+
+
+class ConfigDialogTest(unittest.TestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ requires('gui')
+ cls.root = Tk()
+ _initializeTkVariantTests(cls.root)
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.root.destroy()
+ del cls.root
+
+ def test_dialog(self):
+ d=ConfigDialog(self.root, 'Test', _utest=True)
+ d.destroy()
+
+
+if __name__ == '__main__':
+ unittest.main(verbosity=2)