[pypy-commit] pypy stdlib-2.7.9: Fix remaining failures in test_ttk_guionly
amauryfa
noreply at buildbot.pypy.org
Sun Jan 25 17:11:01 CET 2015
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: stdlib-2.7.9
Changeset: r75515:66226c524e36
Date: 2015-01-25 17:08 +0100
http://bitbucket.org/pypy/pypy/changeset/66226c524e36/
Log: Fix remaining failures in test_ttk_guionly
diff --git a/lib-python/2.7/lib-tk/test/test_ttk/test_extensions.py b/lib-python/2.7/lib-tk/test/test_ttk/test_extensions.py
--- a/lib-python/2.7/lib-tk/test/test_ttk/test_extensions.py
+++ b/lib-python/2.7/lib-tk/test/test_ttk/test_extensions.py
@@ -2,7 +2,7 @@
import unittest
import Tkinter as tkinter
import ttk
-from test.test_support import requires, run_unittest, swap_attr
+from test.test_support import requires, run_unittest, swap_attr, gc_collect
from test_ttk.support import AbstractTkTest, destroy_default_root
requires('gui')
@@ -18,6 +18,7 @@
x = ttk.LabeledScale(self.root)
var = x._variable._name
x.destroy()
+ gc_collect()
self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var)
# manually created variable
@@ -25,11 +26,13 @@
name = myvar._name
x = ttk.LabeledScale(self.root, variable=myvar)
x.destroy()
+ gc_collect()
if self.wantobjects:
self.assertEqual(x.tk.globalgetvar(name), myvar.get())
else:
self.assertEqual(float(x.tk.globalgetvar(name)), myvar.get())
del myvar
+ gc_collect()
self.assertRaises(tkinter.TclError, x.tk.globalgetvar, name)
# checking that the tracing callback is properly removed
@@ -37,6 +40,7 @@
# LabeledScale will start tracing myvar
x = ttk.LabeledScale(self.root, variable=myvar)
x.destroy()
+ gc_collect()
# Unless the tracing callback was removed, creating a new
# LabeledScale with the same var will cause an error now. This
# happens because the variable will be set to (possibly) a new
@@ -216,6 +220,7 @@
optmenu.destroy()
self.assertEqual(optmenu.tk.globalgetvar(name), var.get())
del var
+ gc_collect()
self.assertRaises(tkinter.TclError, optmenu.tk.globalgetvar, name)
diff --git a/lib-python/2.7/lib-tk/test/test_ttk/test_widgets.py b/lib-python/2.7/lib-tk/test/test_ttk/test_widgets.py
--- a/lib-python/2.7/lib-tk/test/test_ttk/test_widgets.py
+++ b/lib-python/2.7/lib-tk/test/test_ttk/test_widgets.py
@@ -2,7 +2,7 @@
import Tkinter as tkinter
from Tkinter import TclError
import ttk
-from test.test_support import requires, run_unittest
+from test.test_support import requires, run_unittest, gc_collect
import sys
from test_functions import MockTclObj
@@ -838,6 +838,7 @@
self.assertEqual(conv(self.scale.get()), var.get())
self.assertEqual(conv(self.scale.get()), max + 5)
del var
+ gc_collect()
# the same happens with the value option
self.scale['value'] = max + 10
diff --git a/lib_pypy/_tkinter/tclobj.py b/lib_pypy/_tkinter/tclobj.py
--- a/lib_pypy/_tkinter/tclobj.py
+++ b/lib_pypy/_tkinter/tclobj.py
@@ -114,8 +114,7 @@
def __repr__(self):
return "<%s object at 0x%x>" % (
- tkffi.string(self._value.typePtr.name),
- tkffi.cast("intptr_t", self._value))
+ self.typename, tkffi.cast("intptr_t", self._value))
def __eq__(self, other):
if not isinstance(other, TclObject):
@@ -123,6 +122,10 @@
return self._value == other._value
@property
+ def typename(self):
+ return tkffi.string(self._value.typePtr.name)
+
+ @property
def string(self):
if self._string is None:
length = tkffi.new("int*")
More information about the pypy-commit
mailing list