From: Terry Jan Reedy Date: Fri, 30 Oct 2015 06:47:01 +0000 (-0400) Subject: Issue #25507: move test-specific imports to test function (idlelib.IOBinding). X-Git-Tag: v2.7.11rc1~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=faaf16b8ed273bb974ea18183ef17f078e0d3944;p=python Issue #25507: move test-specific imports to test function (idlelib.IOBinding). --- diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 7c80bc5122..3b39606d9d 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -5,21 +5,18 @@ # end-of-line conventions, instead of relying on the standard library, # which will only understand the local convention. +import codecs +from codecs import BOM_UTF8 import os import pipes +import re import sys -import codecs import tempfile + import tkFileDialog import tkMessageBox -import re -from Tkinter import * from SimpleDialog import SimpleDialog -from idlelib.configHandler import idleConf - -from codecs import BOM_UTF8 - # Try setting the locale, so that we can find out # what encoding to use try: @@ -567,8 +564,12 @@ class IOBinding: "Update recent file list on all editor windows" self.editwin.update_recent_files_list(filename) + def _io_binding(parent): # htest # - root = Tk() + from Tkinter import Toplevel, Text + from idlelib.configHandler import idleConf + + root = Toplevel(parent) root.title("Test IOBinding") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) root.geometry("+%d+%d"%(x, y + 150)) @@ -585,6 +586,7 @@ def _io_binding(parent): # htest # self.text.event_generate("<>") def save(self, event): self.text.event_generate("<>") + def update_recent_files_list(s, f): pass text = Text(root) text.pack() diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py index bad0468613..a3e6d3a88e 100644 --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -189,9 +189,11 @@ _grep_dialog_spec = { _io_binding_spec = { 'file': 'IOBinding', 'kwds': {}, - 'msg': "Test the following bindings\n" - " to display open window from file dialog.\n" - " to save the file\n" + 'msg': "Test the following bindings.\n" + " to open file from dialog.\n" + "Edit the file.\n" + " to save the file.\n" + "Check that changes were saved by opening the file elsewhere." } _multi_call_spec = {