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.
This commit is contained in:
Terry Jan Reedy 2014-05-11 23:32:32 -04:00
parent 23a192d963
commit 06313b79d5
4 changed files with 114 additions and 32 deletions

View file

@ -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)