aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtWidgets/action_clear.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-03-07 14:27:30 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-03-07 14:45:03 +0100
commit28099de59b5203166990a109fa8b176b22c6e377 (patch)
tree421ee6235e7afbb2c606a8244362c0b673515571 /sources/pyside6/tests/QtWidgets/action_clear.py
parentd6d63cf55a0ceb4c1fdcea4d9741e22ed4b2a979 (diff)
Fix some tests checking delection for PyPy
Add gc.collect(). Task-number: PYSIDE-535 Task-number: PYSIDE-1843 Change-Id: Ia52e53a42cb6fa266dfabcec607fb3391eb9d22a Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/tests/QtWidgets/action_clear.py')
-rw-r--r--sources/pyside6/tests/QtWidgets/action_clear.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/sources/pyside6/tests/QtWidgets/action_clear.py b/sources/pyside6/tests/QtWidgets/action_clear.py
index f9f416a9c..e1d7371b0 100644
--- a/sources/pyside6/tests/QtWidgets/action_clear.py
+++ b/sources/pyside6/tests/QtWidgets/action_clear.py
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -53,6 +54,8 @@ class TestQActionLifeCycle(UsesQApplication):
act = None
self.assertFalse(self._actionDestroyed)
menu.clear()
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._actionDestroyed)
def testMenuBar(self):
@@ -62,8 +65,12 @@ class TestQActionLifeCycle(UsesQApplication):
act = menuBar.addAction("MENU")
_ref = weakref.ref(act, self.actionDestroyed)
act = None
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertFalse(self._actionDestroyed)
menuBar.clear()
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._actionDestroyed)
def testToolBar(self):
@@ -73,8 +80,12 @@ class TestQActionLifeCycle(UsesQApplication):
act = toolBar.addAction("MENU")
_ref = weakref.ref(act, self.actionDestroyed)
act = None
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertFalse(self._actionDestroyed)
toolBar.clear()
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._actionDestroyed)