[pygobject] tests: add a test failing under PyPy due to missing toggle refs
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] tests: add a test failing under PyPy due to missing toggle refs
- Date: Mon, 2 Apr 2018 09:43:55 +0000 (UTC)
commit 4ed51b6b89be073cde37bb3e32986c9127446d30
Author: Christoph Reiter <reiter christoph gmail com>
Date: Mon Apr 2 11:41:36 2018 +0200
tests: add a test failing under PyPy due to missing toggle refs
Once the vfunc is called all the refs to the instance wrapper are gone
and under PyPy we get a new wrapper because for some reason toggle
refs aren't triggered.
tests/test_overrides_gtk.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 0a1d08fd..7ffb5068 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -8,6 +8,7 @@ import contextlib
import unittest
import time
import sys
+import gc
import warnings
from .helper import ignore_gi_deprecation_warnings, capture_glib_warnings
@@ -68,6 +69,27 @@ def realized(widget):
Gtk.main_iteration()
+@unittest.skipUnless(Gtk, 'Gtk not available')
+def test_wrapper_toggle_refs():
+ class MyButton(Gtk.Button):
+ def __init__(self, height):
+ Gtk.Button.__init__(self)
+ self._height = height
+
+ def do_get_preferred_height(self):
+ return (self._height, self._height)
+
+ height = 142
+ w = Gtk.Window()
+ b = MyButton(height)
+ w.add(b)
+ b.show_all()
+ del b
+ gc.collect()
+ gc.collect()
+ assert w.get_preferred_size().minimum_size.height == height
+
+
@unittest.skipUnless(Gtk, 'Gtk not available')
@ignore_gi_deprecation_warnings
class TestGtk(unittest.TestCase):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]