diff options
author | Gustavo J. A. M. Carneiro <gjc@src.gnome.org> | 2007-05-03 10:28:56 +0000 |
---|---|---|
committer | Gustavo J. A. M. Carneiro <gjc@src.gnome.org> | 2007-05-03 10:28:56 +0000 |
commit | 25e96042c91016286b59639b83c42cb7444561f5 (patch) | |
tree | 3ff584b9b7a6c197cd32082b905c74dd55279403 /tests/test_gdk.py | |
parent | 514aec8f9571c3212a6ae1640f83f6a6cf713f7b (diff) | |
download | pygtk-25e96042c91016286b59639b83c42cb7444561f5.tar.gz |
Fix some unit tests to account for the new memory management model in pygobject 2.13.
svn path=/trunk/; revision=2818
Diffstat (limited to 'tests/test_gdk.py')
-rw-r--r-- | tests/test_gdk.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/test_gdk.py b/tests/test_gdk.py index e23c4583..d589f6fd 100644 --- a/tests/test_gdk.py +++ b/tests/test_gdk.py @@ -1,7 +1,7 @@ import unittest import gc -from common import gtk +from common import gtk, gobject class CallOnDel: def __init__(self, callback): @@ -52,7 +52,7 @@ class GdkTest(unittest.TestCase): while True: x = gc.collect() cnt += x - if x: + if x == 0: break return cnt @@ -61,13 +61,23 @@ class GdkTest(unittest.TestCase): pass display = gtk.gdk.Display(None) - del display - - self.assertEquals(self._collect(), 1) + if gobject.pygobject_version >= (2,13): + dispref = display.weak_ref() + del display + self.assertEqual(dispref(), None) + else: + del display + self.assertEquals(self._collect(), 1) display = gtk.gdk.Display(None) self.assertEquals(display.__grefcount__, 1) display.close() self.assertEquals(display.__grefcount__, 1) - del display - self.assertEquals(self._collect(), 1) + + if gobject.pygobject_version >= (2,13): + dispref = display.weak_ref() + del display + self.assertEqual(dispref(), None) + else: + del display + self.assertEquals(self._collect(), 1) |