summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/EditorWindow.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-05-12 03:32:32 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-05-12 03:32:32 (GMT)
commit06313b79d5c0eaeed8f37838b5e9a064eecf0b98 (patch)
tree8e0099e27737088549327238291dbd5f3e612d90 /Lib/idlelib/EditorWindow.py
parent23a192d9633ace0fe83c9ac392e1df06d8c35da6 (diff)
downloadcpython-06313b79d5c0eaeed8f37838b5e9a064eecf0b98.zip
cpython-06313b79d5c0eaeed8f37838b5e9a064eecf0b98.tar.gz
cpython-06313b79d5c0eaeed8f37838b5e9a064eecf0b98.tar.bz2
Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin
consolidating and improving human-validated tests of Idle. Change other files as needed to work with htest. Running the module as __main__ runs all tests.
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r--Lib/idlelib/EditorWindow.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index cdb6775..06fb137 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -79,6 +79,8 @@ class HelpDialog(object):
self.parent = None
helpDialog = HelpDialog() # singleton instance
+def _Help_dialog(parent): # wrapper for htest
+ helpDialog.show_dialog(parent)
class EditorWindow(object):
@@ -1064,7 +1066,7 @@ class EditorWindow(object):
try:
try:
mod = importlib.import_module('.' + name, package=__package__)
- except ImportError:
+ except (ImportError, TypeError):
mod = importlib.import_module(name)
except ImportError:
print("\nFailed to import extension: ", name)
@@ -1700,19 +1702,21 @@ def fixwordbreaks(root):
tk.call('set', 'tcl_nonwordchars', '[^a-zA-Z0-9_]')
-def test():
- root = Tk()
+def _Editor_window(parent):
+ root = parent
fixwordbreaks(root)
root.withdraw()
if sys.argv[1:]:
filename = sys.argv[1]
else:
filename = None
+ macosxSupport.setupApp(root, None)
edit = EditorWindow(root=root, filename=filename)
edit.set_close_hook(root.quit)
edit.text.bind("<<close-all-windows>>", edit.close_event)
- root.mainloop()
- root.destroy()
if __name__ == '__main__':
- test()
+ from idlelib.idle_test.htest import run
+ if len(sys.argv) <= 1:
+ run(_Help_dialog)
+ run(_Editor_window)