[Python-checkins] cpython (2.7): Backports: #25747: remove bad test. #27044: stop test_idle from leaking.

terry.reedy python-checkins at python.org
Mon May 16 22:28:19 EDT 2016


https://hg.python.org/cpython/rev/9e1c859562bb
changeset:   101391:9e1c859562bb
branch:      2.7
parent:      101378:9acf44b7ff7b
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Mon May 16 22:27:22 2016 -0400
summary:
  Backports: #25747: remove bad test.  #27044: stop test_idle from leaking.

files:
  Lib/idlelib/configDialog.py                |  10 ++++++++++
  Lib/idlelib/idle_test/test_configdialog.py |   1 +
  Lib/idlelib/idle_test/test_warning.py      |   9 ---------
  3 files changed, 11 insertions(+), 9 deletions(-)


diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -500,6 +500,16 @@
         self.autoSave.trace_variable('w', self.VarChanged_autoSave)
         self.encoding.trace_variable('w', self.VarChanged_encoding)
 
+    def remove_var_callbacks(self):
+        for var in (
+                self.fontSize, self.fontName, self.fontBold,
+                self.spaceNum, self.colour, self.builtinTheme,
+                self.customTheme, self.themeIsBuiltin, self.highlightTarget,
+                self.keyBinding, self.builtinKeys, self.customKeys,
+                self.keysAreBuiltin, self.winWidth, self.winHeight,
+                self.startupEdit, self.autoSave, self.encoding,):
+            var.trace_vdelete('w', var.trace_vinfo()[0][1])
+
     def VarChanged_font(self, *params):
         '''When one font attribute changes, save them all, as they are
         not independent from each other. In particular, when we are
diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -25,6 +25,7 @@
 
     def test_dialog(self):
         d=ConfigDialog(self.root, 'Test', _utest=True)
+        d.remove_var_callbacks()
         d.destroy()
 
 
diff --git a/Lib/idlelib/idle_test/test_warning.py b/Lib/idlelib/idle_test/test_warning.py
--- a/Lib/idlelib/idle_test/test_warning.py
+++ b/Lib/idlelib/idle_test/test_warning.py
@@ -68,15 +68,6 @@
                     'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code')
             self.assertEqual(shellmsg.splitlines(), f.getvalue().splitlines())
 
-class ImportWarnTest(unittest.TestCase):
-    def test_idlever(self):
-        with warnings.catch_warnings(record=True) as w:
-            warnings.simplefilter("always")
-            import idlelib.idlever
-            self.assertEqual(len(w), 1)
-            self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
-            self.assertIn("version", str(w[-1].message))
-
 
 if __name__ == '__main__':
     unittest.main(verbosity=2, exit=False)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list