[pygobject] test_gi: gc.collect() some more



commit 52ef81c48d80126312f128182928cbbc195d255c
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sun Apr 1 12:18:29 2018 +0200

    test_gi: gc.collect() some more
    
    And adds a simpler version of previously failing test.
    Not sure about why this helps.

 tests/test_gi.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]