summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-04-01 12:18:29 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-04-01 12:24:57 +0200
commit52ef81c48d80126312f128182928cbbc195d255c (patch)
treed7e002ca45b76f3705fcbdf07ffaa336897670f8
parentb747c628ec5f2a9ee9ced4d59d4b04d5167be5e4 (diff)
downloadpygobject-52ef81c48d80126312f128182928cbbc195d255c.tar.gz
test_gi: gc.collect() some more
And adds a simpler version of previously failing test. Not sure about why this helps.
-rw-r--r--tests/test_gi.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 4d65e803..db138e66 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1614,6 +1614,15 @@ class TestGValue(unittest.TestCase):
values = GIMarshallingTests.return_gvalue_flat_array()
self.assertEqual(values, [42, '42', True])
+ def test_gvalue_gobject_ref_counts_simple(self):
+ obj = GObject.Object()
+ grefcount = obj.__grefcount__
+ value = GObject.Value(GObject.TYPE_OBJECT, obj)
+ del value
+ gc.collect()
+ gc.collect()
+ assert obj.__grefcount__ == grefcount
+
def test_gvalue_gobject_ref_counts(self):
# Tests a GObject held by a GValue
obj = GObject.Object()
@@ -1645,6 +1654,7 @@ class TestGValue(unittest.TestCase):
del res
del value
gc.collect()
+ gc.collect()
self.assertEqual(obj.__grefcount__, grefcount)
del obj