[Python-checkins] cpython (2.7): Issue #25507: move test-specific imports to test function (idlelib.IOBinding).

terry.reedy python-checkins at python.org
Fri Oct 30 02:48:15 EDT 2015


https://hg.python.org/cpython/rev/a37ea1d56e98
changeset: 98896:a37ea1d56e98
branch: 2.7
parent: 98892:31fd613a40aa
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Fri Oct 30 02:47:01 2015 -0400
summary:
 Issue #25507: move test-specific imports to test function (idlelib.IOBinding).
files:
 Lib/idlelib/IOBinding.py | 18 ++++++++++--------
 Lib/idlelib/idle_test/htest.py | 8 +++++---
 2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
--- 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 @@
 "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 @@
 self.text.event_generate("<<open-window-from-file>>")
 def save(self, event):
 self.text.event_generate("<<save-window>>")
+ 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
--- a/Lib/idlelib/idle_test/htest.py
+++ b/Lib/idlelib/idle_test/htest.py
@@ -189,9 +189,11 @@
 _io_binding_spec = {
 'file': 'IOBinding',
 'kwds': {},
- 'msg': "Test the following bindings\n"
- "<Control-o> to display open window from file dialog.\n"
- "<Control-s> to save the file\n"
+ 'msg': "Test the following bindings.\n"
+ "<Control-o> to open file from dialog.\n"
+ "Edit the file.\n"
+ "<Control-s> to save the file.\n"
+ "Check that changes were saved by opening the file elsewhere."
 }
 
 _multi_call_spec = {
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /