aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-10-25 19:22:33 +0200
committerChristian Tismer <tismer@stackless.com>2021-10-27 14:07:48 +0200
commitc7c789b1822fe0b2e77e66e5c1a66a16b3c3c405 (patch)
treed299b5cce39f42335f03eb4711e5634e2e122aec /sources
parent55eebea1a48cbf5c2caef5b89226ad5c1fb18971 (diff)
PyPySide: fix quite a few tests using del or __del__
In PyPy, the __del__ method is only triggered reliably by calling gc.collect() Also, the del statement does a deletion from the namespace, but the real deletion happens when gc.collent() is called. This was applied to all tests which use del, regardless if it has a visible effect on PyPy or not. It turned out to save more 8 errors, which is great. Task-number: PYSIDE-535 Change-Id: I6a58d90629c9eafec7307c17f021251113b3c7f2 Pick-to: 6.2 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside6/tests/QtCore/blocking_signals_test.py9
-rw-r--r--sources/pyside6/tests/QtCore/bug_505.py5
-rw-r--r--sources/pyside6/tests/QtCore/bug_829.py7
-rw-r--r--sources/pyside6/tests/QtCore/bug_953.py5
-rw-r--r--sources/pyside6/tests/QtCore/deletelater_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/destroysignal_test.py7
-rw-r--r--sources/pyside6/tests/QtCore/duck_punching_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qbitarray_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qcbor_test.py7
-rw-r--r--sources/pyside6/tests/QtCore/qenum_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qobject_children_segfault_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qobject_event_filter_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qobject_inherits_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qobject_parent_test.py7
-rw-r--r--sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qproperty_decorator.py5
-rw-r--r--sources/pyside6/tests/QtCore/qsettings_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qthread_prod_cons_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qtimer_singleshot_test.py7
-rw-r--r--sources/pyside6/tests/QtCore/qtimer_timeout_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/tr_noop_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/unaryoperator_test.py5
-rw-r--r--sources/pyside6/tests/QtGui/bug_652.py3
-rw-r--r--sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py5
-rw-r--r--sources/pyside6/tests/QtGui/qcolor_test.py7
-rw-r--r--sources/pyside6/tests/QtGui/qfontmetrics_test.py7
-rw-r--r--sources/pyside6/tests/QtGui/qpainter_test.py5
-rw-r--r--sources/pyside6/tests/QtNetwork/dnslookup_test.py5
-rw-r--r--sources/pyside6/tests/QtNetwork/tcpserver_test.py5
-rw-r--r--sources/pyside6/tests/QtNetwork/udpsocket_test.py5
-rw-r--r--sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py5
-rw-r--r--sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py8
-rw-r--r--sources/pyside6/tests/QtTest/touchevent_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/add_action_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1002.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1006.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_576.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_921.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/paint_event_test.py19
-rw-r--r--sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qdynamic_signal.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py10
-rw-r--r--sources/pyside6/tests/QtWidgets/qlabel_test.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_ref_test.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qmenu_test.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qtabwidget_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbar_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbox_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreeview_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qvariant_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py5
-rw-r--r--sources/pyside6/tests/QtXml/qdomdocument_test.py5
-rw-r--r--sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py5
-rw-r--r--sources/pyside6/tests/pysidetest/notify_id.py3
-rw-r--r--sources/pyside6/tests/pysidetest/property_python_test.py5
-rw-r--r--sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py5
-rw-r--r--sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py5
-rw-r--r--sources/pyside6/tests/signals/invalid_callback_test.py5
-rw-r--r--sources/pyside6/tests/signals/pysignal_test.py9
-rw-r--r--sources/pyside6/tests/signals/qobject_destroyed_test.py5
-rw-r--r--sources/pyside6/tests/signals/qobject_receivers_test.py7
-rw-r--r--sources/pyside6/tests/signals/ref01_test.py5
-rw-r--r--sources/pyside6/tests/signals/ref02_test.py5
-rw-r--r--sources/pyside6/tests/signals/ref03_test.py5
-rw-r--r--sources/pyside6/tests/signals/ref04_test.py5
-rw-r--r--sources/pyside6/tests/signals/ref05_test.py5
-rw-r--r--sources/pyside6/tests/signals/ref06_test.py5
-rw-r--r--sources/pyside6/tests/signals/segfault_proxyparent_test.py7
-rw-r--r--sources/pyside6/tests/signals/short_circuit_test.py5
-rw-r--r--sources/pyside6/tests/signals/signal2signal_connect_test.py9
-rw-r--r--sources/pyside6/tests/signals/signal_emission_gui_test.py5
-rw-r--r--sources/pyside6/tests/signals/static_metaobject_test.py7
-rw-r--r--sources/pyside6/tests/util/helper/basicpyslotcase.py6
-rw-r--r--sources/pyside6/tests/util/helper/timedqapplication.py5
-rw-r--r--sources/pyside6/tests/util/helper/usesqapplication.py5
-rw-r--r--sources/pyside6/tests/util/helper/usesqcoreapplication.py5
-rw-r--r--sources/pyside6/tests/util/helper/usesqguiapplication.py5
-rw-r--r--sources/shiboken6/tests/otherbinding/otherderived_test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/__del___test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/argumentmodifications_test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/child_return_test.py7
-rw-r--r--sources/shiboken6/tests/samplebinding/cyclic_test.py15
-rw-r--r--sources/shiboken6/tests/samplebinding/modifications_test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py3
-rw-r--r--sources/shiboken6/tests/samplebinding/objecttypelayout_test.py19
-rw-r--r--sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py9
-rw-r--r--sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/ownership_transference_test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/protected_test.py15
-rw-r--r--sources/shiboken6/tests/samplebinding/typedealloc_test.py4
-rw-r--r--sources/shiboken6/tests/samplebinding/virtualdtor_test.py9
-rw-r--r--sources/shiboken6/tests/samplebinding/virtualmethods_test.py5
-rw-r--r--sources/shiboken6/tests/samplebinding/weakref_test.py7
-rw-r--r--sources/shiboken6/tests/smartbinding/smart_pointer_test.py14
100 files changed, 501 insertions, 106 deletions
diff --git a/sources/pyside6/tests/QtCore/blocking_signals_test.py b/sources/pyside6/tests/QtCore/blocking_signals_test.py
index b51ba2c7a..d4d59b457 100644
--- a/sources/pyside6/tests/QtCore/blocking_signals_test.py
+++ b/sources/pyside6/tests/QtCore/blocking_signals_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
''' Test case for QObject.signalsBlocked() and blockSignal()'''
+import gc
import os
import sys
from tempfile import mkstemp
@@ -60,6 +61,8 @@ class TestSignalsBlockedBasic(unittest.TestCase):
blocker.reblock()
self.assertTrue(obj.signalsBlocked())
del blocker
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(not obj.signalsBlocked())
def testContext(self):
@@ -83,6 +86,8 @@ class TestSignalsBlocked(unittest.TestCase):
# Delete used resources
del self.obj
del self.args
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def callback(self, *args):
# Default callback
@@ -132,6 +137,8 @@ class TestQFileSignalBlocking(unittest.TestCase):
# Release acquired resources
os.remove(self.filename)
del self.qfile
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def callback(self):
# Default callback
diff --git a/sources/pyside6/tests/QtCore/bug_505.py b/sources/pyside6/tests/QtCore/bug_505.py
index a00973fea..d9ecdae09 100644
--- a/sources/pyside6/tests/QtCore/bug_505.py
+++ b/sources/pyside6/tests/QtCore/bug_505.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -54,6 +55,8 @@ class CheckForEventsTypes(unittest.TestCase):
o = MyBaseObject(p)
del o
del p
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtCore/bug_829.py b/sources/pyside6/tests/QtCore/bug_829.py
index c5636f62a..7cab82c5e 100644
--- a/sources/pyside6/tests/QtCore/bug_829.py
+++ b/sources/pyside6/tests/QtCore/bug_829.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Copyright (C) 2011 Thomas Perl <thp.io/about>
## Contact: https://www.qt.io/licensing/
##
@@ -29,6 +29,7 @@
# Test case for PySide bug 829
+import gc
import os
import sys
import unittest
@@ -52,6 +53,8 @@ class QVariantConversions(unittest.TestCase):
confFile.close()
self._confFileName = confFile.fileName()
del confFile
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
s = QSettings(self._confFileName, QSettings.IniFormat)
self.assertEqual(s.status(), QSettings.NoError)
# Save value
@@ -59,6 +62,8 @@ class QVariantConversions(unittest.TestCase):
s.sync()
self.assertEqual(s.status(), QSettings.NoError)
del s
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
# Restore value
s = QSettings(self._confFileName, QSettings.IniFormat)
diff --git a/sources/pyside6/tests/QtCore/bug_953.py b/sources/pyside6/tests/QtCore/bug_953.py
index 0a8c3bdcb..a593709cb 100644
--- a/sources/pyside6/tests/QtCore/bug_953.py
+++ b/sources/pyside6/tests/QtCore/bug_953.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
@@ -48,6 +49,8 @@ class Dispatcher(QObject):
def _finish(self):
del self._me # It can't crash here!
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
QTimer.singleShot(10, QCoreApplication.instance().quit)
diff --git a/sources/pyside6/tests/QtCore/deletelater_test.py b/sources/pyside6/tests/QtCore/deletelater_test.py
index 033b0cc70..18619238d 100644
--- a/sources/pyside6/tests/QtCore/deletelater_test.py
+++ b/sources/pyside6/tests/QtCore/deletelater_test.py
@@ -30,6 +30,7 @@
'''Test cases for QTimer.singleShot'''
+import gc
import os
import sys
import unittest
@@ -50,6 +51,8 @@ class TestDeleteLater(UsesQCoreApplication):
o = QObject()
o.deleteLater()
del o
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
QTimer.singleShot(100, self.app.quit)
self.app.exec()
diff --git a/sources/pyside6/tests/QtCore/destroysignal_test.py b/sources/pyside6/tests/QtCore/destroysignal_test.py
index ff657a800..38906b919 100644
--- a/sources/pyside6/tests/QtCore/destroysignal_test.py
+++ b/sources/pyside6/tests/QtCore/destroysignal_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -48,6 +49,8 @@ class TestDestroySignal(unittest.TestCase):
t = QTimer()
t.destroyed[QObject].connect(self.onObjectDestroyed)
del t
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._destroyed)
def testWithParent(self):
@@ -56,6 +59,8 @@ class TestDestroySignal(unittest.TestCase):
t = QTimer(p)
t.destroyed[QObject].connect(self.onObjectDestroyed)
del p
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._destroyed)
diff --git a/sources/pyside6/tests/QtCore/duck_punching_test.py b/sources/pyside6/tests/QtCore/duck_punching_test.py
index ab682026b..8b5ece4f6 100644
--- a/sources/pyside6/tests/QtCore/duck_punching_test.py
+++ b/sources/pyside6/tests/QtCore/duck_punching_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
'''Test case for duck punching new implementations of C++ virtual methods into object instances.'''
+import gc
import os
import sys
import types
@@ -67,6 +68,8 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
def tearDown(self):
# Release resources
del self.duck_childEvent_called
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def testChildEventMonkeyPatch(self):
diff --git a/sources/pyside6/tests/QtCore/qbitarray_test.py b/sources/pyside6/tests/QtCore/qbitarray_test.py
index 580fa1f5b..ef299b1a5 100644
--- a/sources/pyside6/tests/QtCore/qbitarray_test.py
+++ b/sources/pyside6/tests/QtCore/qbitarray_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
'''Tests if QBitArray class is iterable and also '~' (__invert__) and bitwise operators'''
+import gc
import os
import sys
import unittest
@@ -79,6 +80,8 @@ class QBitArrayIsIterableTest(unittest.TestCase):
del self.qbitarray_values
del self.other_qbitarray_values
del self.inverted_qbitarray_values
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testQBitArrayIsIterable(self):
# Tests if QBitArray class is iterable
diff --git a/sources/pyside6/tests/QtCore/qcbor_test.py b/sources/pyside6/tests/QtCore/qcbor_test.py
index e29921763..f71257ae7 100644
--- a/sources/pyside6/tests/QtCore/qcbor_test.py
+++ b/sources/pyside6/tests/QtCore/qcbor_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2018 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
'''Test cases for QCbor'''
+import gc
import os
import sys
import unittest
@@ -49,6 +50,8 @@ class TestCbor(unittest.TestCase):
writer = QCborStreamWriter(ba)
writer.append(42)
del writer
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(not ba.isEmpty())
reader = QCborStreamReader(ba)
self.assertTrue(reader.hasNext())
@@ -60,6 +63,8 @@ class TestCbor(unittest.TestCase):
writer = QCborStreamWriter(ba)
writer.append("hello")
del writer
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(not ba.isEmpty())
reader = QCborStreamReader(ba)
self.assertTrue(reader.hasNext())
diff --git a/sources/pyside6/tests/QtCore/qenum_test.py b/sources/pyside6/tests/QtCore/qenum_test.py
index 76caa9a37..1f32d957f 100644
--- a/sources/pyside6/tests/QtCore/qenum_test.py
+++ b/sources/pyside6/tests/QtCore/qenum_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -164,6 +164,8 @@ except ImportError:
Enum.__module__ = "enum"
Enum.__members__ = {}
del Enum
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
enum.auto = lambda: 42
HAVE_FLAG = hasattr(enum, "Flag")
diff --git a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
index c04c8b3c4..d13d791c7 100644
--- a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
+++ b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
''' Test case for QAbstractListModel.createIndex and QModelIndex.internalPointer'''
+import gc
import os
import sys
import unittest
@@ -56,6 +57,8 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
def tearDown(self):
# Release resources
del self.model
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testInternalPointer(self):
# Test QAbstractListModel.createIndex and
diff --git a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
index cab045ddc..ae899da9f 100644
--- a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for parent-child relationship'''
+import gc
import os
import sys
import unittest
@@ -57,6 +58,8 @@ class ChildrenCoreApplication(unittest.TestCase):
# del children
# del child2
del parent # XXX Segfaults here
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(True)
diff --git a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
index 73c1544ed..846de3ca5 100644
--- a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QObject.eventFilter'''
+import gc
import os
import sys
import unittest
@@ -100,6 +101,8 @@ class TestQObjectEventFilterPython(UsesQCoreApplication):
def tearDown(self):
# Release resources
del self.obj_filter
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def testEventFilter(self):
diff --git a/sources/pyside6/tests/QtCore/qobject_inherits_test.py b/sources/pyside6/tests/QtCore/qobject_inherits_test.py
index e2577fd40..ff595887a 100644
--- a/sources/pyside6/tests/QtCore/qobject_inherits_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_inherits_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QObject methods'''
+import gc
import os
import sys
import unittest
@@ -125,6 +126,8 @@ class InheritsCase(unittest.TestCase):
child.deleteLater()
self.assertTrue(is_alive)
del child
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(is_alive)
QTimer.singleShot(100, app.quit)
app.exec()
diff --git a/sources/pyside6/tests/QtCore/qobject_parent_test.py b/sources/pyside6/tests/QtCore/qobject_parent_test.py
index 9dcbc05da..be1b1d0d9 100644
--- a/sources/pyside6/tests/QtCore/qobject_parent_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_parent_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for parent-child relationship'''
+import gc
import os
import sys
import unittest
@@ -62,6 +63,8 @@ class ParentRefCountCase(unittest.TestCase):
# Release resources
del self.child
del self.parent
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testSetParent(self):
@@ -105,6 +108,8 @@ class ParentCase(unittest.TestCase):
orig_repr = repr(child)
del child
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(orig_repr, repr(parent.children()[0]))
def testChildren(self):
diff --git a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
index f70c04344..d69041935 100644
--- a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Unit tests for QObject's tr static methods.'''
+import gc
import os
import os
import sys
@@ -54,6 +55,8 @@ class QObjectTrTest(unittest.TestCase):
def tearDown(self):
del self.obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testTrCommonCase(self):
# Test common case for QObject.tr
diff --git a/sources/pyside6/tests/QtCore/qproperty_decorator.py b/sources/pyside6/tests/QtCore/qproperty_decorator.py
index 424b9dc9a..bae192817 100644
--- a/sources/pyside6/tests/QtCore/qproperty_decorator.py
+++ b/sources/pyside6/tests/QtCore/qproperty_decorator.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -67,6 +68,8 @@ class PropertyTest(unittest.TestCase):
self.assertEqual(o._value, 10)
self.assertEqual(o.value, 10)
del o
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._obDestroyed)
diff --git a/sources/pyside6/tests/QtCore/qsettings_test.py b/sources/pyside6/tests/QtCore/qsettings_test.py
index 72f3c3f00..7303adba8 100644
--- a/sources/pyside6/tests/QtCore/qsettings_test.py
+++ b/sources/pyside6/tests/QtCore/qsettings_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2019 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QDate'''
+import gc
import os
import sys
import unittest
@@ -80,6 +81,8 @@ class TestQSettings(unittest.TestCase):
settings.setValue('bool1', False)
settings.setValue('bool2', True)
del settings
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
# Loading values already set
settings = QSettings(file_name, QSettings.IniFormat)
diff --git a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
index 27178361d..dbe37416e 100644
--- a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
+++ b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
'''Producer-Consumer test/example with QThread'''
+import gc
import logging
import os
from random import random
@@ -116,6 +117,8 @@ class ProducerConsumer(unittest.TestCase):
def tearDown(self):
# Destroy fixtures
del self.app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def finishCb(self):
# Quits the application
diff --git a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
index 7aa315e17..baf3ae2f3 100644
--- a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
+++ b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
'''Test cases for QTimer.singleShot'''
+import gc
import os
import sys
import unittest
@@ -70,6 +71,8 @@ class TestSingleShot(UsesQCoreApplication):
# Release resources
del self.watchdog
del self.called
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def callback(self):
@@ -98,6 +101,8 @@ class TestSingleShotSignal(UsesQCoreApplication):
def tearDown(self):
del self.watchdog
del self.called
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def callback(self):
diff --git a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
index 7dbd30bd7..c00e237d6 100644
--- a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
+++ b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test case for timeout() signals from QTimer object.'''
+import gc
import os
import sys
import unittest
@@ -70,6 +71,8 @@ class TestTimeoutSignal(UsesQCoreApplication):
del self.watchdog
del self.timer
del self.called
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def callback(self, *args):
diff --git a/sources/pyside6/tests/QtCore/tr_noop_test.py b/sources/pyside6/tests/QtCore/tr_noop_test.py
index b665d4728..efe3302ce 100644
--- a/sources/pyside6/tests/QtCore/tr_noop_test.py
+++ b/sources/pyside6/tests/QtCore/tr_noop_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -46,6 +47,8 @@ class QtTrNoopTest(unittest.TestCase):
def tearDown(self):
del self.txt
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testQtTrNoop(self):
diff --git a/sources/pyside6/tests/QtCore/unaryoperator_test.py b/sources/pyside6/tests/QtCore/unaryoperator_test.py
index 614c92ee5..10cf833df 100644
--- a/sources/pyside6/tests/QtCore/unaryoperator_test.py
+++ b/sources/pyside6/tests/QtCore/unaryoperator_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
'''Tests the presence of unary operator __neg__ on the QPoint class'''
+import gc
import os
import sys
import unittest
@@ -58,6 +59,8 @@ class NegUnaryOperatorTest(unittest.TestCase):
del self.y
del self.neg_x
del self.neg_y
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testNegUnaryOperator(self):
# Test __neg__ unary operator on QPoint class
diff --git a/sources/pyside6/tests/QtGui/bug_652.py b/sources/pyside6/tests/QtGui/bug_652.py
index 5feecd64a..e6b777785 100644
--- a/sources/pyside6/tests/QtGui/bug_652.py
+++ b/sources/pyside6/tests/QtGui/bug_652.py
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -59,6 +60,8 @@ class TestBug652(unittest.TestCase):
self.assertEqual(tc.block().userData().getMyNiceData(), heyHo)
del tc
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
tc = QTextCursor(td)
blk = tc.block()
self.assertEqual(type(blk.userData()), MyData)
diff --git a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
index 5383f79d7..3520eac4a 100644
--- a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
+++ b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QImage'''
+import gc
import os
import sys
import unittest
@@ -55,6 +56,8 @@ class SetPixelFloat(UsesQApplication):
# Release resources
del self.color
del self.image
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(SetPixelFloat, self).tearDown()
def testFloat(self):
diff --git a/sources/pyside6/tests/QtGui/qcolor_test.py b/sources/pyside6/tests/QtGui/qcolor_test.py
index 85ba2de2d..59d6c1a53 100644
--- a/sources/pyside6/tests/QtGui/qcolor_test.py
+++ b/sources/pyside6/tests/QtGui/qcolor_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -27,6 +27,7 @@
#############################################################################
import colorsys
+import gc
import os
import sys
import unittest
@@ -101,6 +102,8 @@ class QColorCopy(unittest.TestCase):
self.assertTrue(original is not copy)
self.assertEqual(original, copy)
del original
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(copy, QColor(0, 0, 255))
def testEmptyCopy(self):
@@ -111,6 +114,8 @@ class QColorCopy(unittest.TestCase):
self.assertTrue(original is not copy)
self.assertEqual(original, copy)
del original
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(copy, QColor())
diff --git a/sources/pyside6/tests/QtGui/qfontmetrics_test.py b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
index 9f3099acd..45245b7bd 100644
--- a/sources/pyside6/tests/QtGui/qfontmetrics_test.py
+++ b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
'''Tests for inject codes and modifications on QFontMetrics
and QFontMetricsF'''
+import gc
import os
import sys
import unittest
@@ -54,6 +55,8 @@ class QFontMetricsTest(UsesQApplication):
def tearDown(self):
del self.metrics
del self.font
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QFontMetricsTest, self).tearDown()
@@ -156,6 +159,8 @@ class QFontMetricsFTest(UsesQApplication):
def tearDown(self):
del self.metrics
del self.font
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QFontMetricsFTest, self).tearDown()
diff --git a/sources/pyside6/tests/QtGui/qpainter_test.py b/sources/pyside6/tests/QtGui/qpainter_test.py
index a099e9df8..489a0e39b 100644
--- a/sources/pyside6/tests/QtGui/qpainter_test.py
+++ b/sources/pyside6/tests/QtGui/qpainter_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -58,6 +59,8 @@ class QPainterDrawText(UsesQGuiApplication):
del self.text
self.painter.end()
del self.painter
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QPainterDrawText, self).tearDown()
def testDrawText(self):
diff --git a/sources/pyside6/tests/QtNetwork/dnslookup_test.py b/sources/pyside6/tests/QtNetwork/dnslookup_test.py
index 21a128c75..1e78e2768 100644
--- a/sources/pyside6/tests/QtNetwork/dnslookup_test.py
+++ b/sources/pyside6/tests/QtNetwork/dnslookup_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2018 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QDnsLookup'''
+import gc
import os
import sys
import unittest
@@ -51,6 +52,8 @@ class DnsLookupTestCase(unittest.TestCase):
def tearDown(self):
del self._lookup
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def _finished(self):
if self._lookup.error() == QDnsLookup.NoError:
diff --git a/sources/pyside6/tests/QtNetwork/tcpserver_test.py b/sources/pyside6/tests/QtNetwork/tcpserver_test.py
index 83eec5660..d84710492 100644
--- a/sources/pyside6/tests/QtNetwork/tcpserver_test.py
+++ b/sources/pyside6/tests/QtNetwork/tcpserver_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QTCPServer'''
+import gc
import os
import sys
import unittest
@@ -50,6 +51,8 @@ class ListenDefaultArgsCase(unittest.TestCase):
def tearDown(self):
# Release resources
del self.server
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testDefaultArgs(self):
# @bug 108
diff --git a/sources/pyside6/tests/QtNetwork/udpsocket_test.py b/sources/pyside6/tests/QtNetwork/udpsocket_test.py
index 630577ab6..351d309e4 100644
--- a/sources/pyside6/tests/QtNetwork/udpsocket_test.py
+++ b/sources/pyside6/tests/QtNetwork/udpsocket_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QUdpSocket'''
+import gc
import os
import sys
import unittest
@@ -62,6 +63,8 @@ class HttpSignalsCase(unittest.TestCase):
del self.socket
del self.server
del self.app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def sendPackage(self):
addr = QHostAddress(QHostAddress.LocalHost)
diff --git a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
index 5c2bd86aa..0f3529734 100644
--- a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
+++ b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -102,6 +103,8 @@ class TestBug(unittest.TestCase):
# instances are destroyed in the correct order.
del view
del app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py b/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py
index 13abb1cd1..382a798b2 100644
--- a/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py
+++ b/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,7 +30,7 @@
'''Test cases for QtSql database creation, destruction and queries'''
-import sys
+import gc
import os
import sys
import unittest
@@ -66,6 +66,8 @@ class SqlDatabaseCreationDestructionAndQueries(unittest.TestCase):
self.db.close()
QSqlDatabase.removeDatabase(":memory:")
del self.db
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testTableCreationAndDestruction(self):
# Test table creation and destruction
@@ -101,6 +103,8 @@ class SqlDatabaseCreationDestructionAndQueries(unittest.TestCase):
model = bar.model
del bar
del app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtTest/touchevent_test.py b/sources/pyside6/tests/QtTest/touchevent_test.py
index f6e264601..cded493d0 100644
--- a/sources/pyside6/tests/QtTest/touchevent_test.py
+++ b/sources/pyside6/tests/QtTest/touchevent_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -62,6 +63,8 @@ class MyWidget(QWidget):
o.press(0, QPoint(10, 10))
o.commit()
del o
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
QTest.touchEvent(self, self._device).press(0, QPoint(10, 10))
QTest.touchEvent(self, self._device).stationary(0).press(1, QPoint(40, 10))
diff --git a/sources/pyside6/tests/QtWidgets/add_action_test.py b/sources/pyside6/tests/QtWidgets/add_action_test.py
index 5342b9d55..d515e87d6 100644
--- a/sources/pyside6/tests/QtWidgets/add_action_test.py
+++ b/sources/pyside6/tests/QtWidgets/add_action_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Tests for QMenuBar.addAction(identifier, callback) calls'''
+import gc
import os
import sys
import unittest
@@ -52,6 +53,8 @@ class AddActionTest(UsesQApplication):
del self.called
except AttributeError:
pass
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(AddActionTest, self).tearDown()
def _callback(self):
diff --git a/sources/pyside6/tests/QtWidgets/bug_1002.py b/sources/pyside6/tests/QtWidgets/bug_1002.py
index 756d936ee..25b4389ee 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1002.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1002.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -51,6 +52,8 @@ class TestBug1002 (UsesQApplication):
self.assertEqual(sys.getrefcount(window), 3)
del widget
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/bug_1006.py b/sources/pyside6/tests/QtWidgets/bug_1006.py
index 81639c34c..3d752e8d4 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1006.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1006.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -60,6 +61,8 @@ class LabelWindow(QDialog):
self.test_layout.removeWidget(old_label)
unit.assertRaises(RuntimeError, old_item.widget)
del old_item
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
label = QLabel("Label New")
old_label.deleteLater()
diff --git a/sources/pyside6/tests/QtWidgets/bug_576.py b/sources/pyside6/tests/QtWidgets/bug_576.py
index 7a078ce9d..ac7895f0c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_576.py
+++ b/sources/pyside6/tests/QtWidgets/bug_576.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,7 +29,7 @@
""" Unittest for bug #576 """
""" http://bugs.openbossa.org/show_bug.cgi?id=576 """
-import sys
+import gc
import os
import sys
import unittest
@@ -64,6 +64,8 @@ class Bug576(unittest.TestCase):
b.setParent(None)
self.assertEqual(sys.getrefcount(b), 2)
del b
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._destroyed)
diff --git a/sources/pyside6/tests/QtWidgets/bug_921.py b/sources/pyside6/tests/QtWidgets/bug_921.py
index 35752e273..966d8861e 100644
--- a/sources/pyside6/tests/QtWidgets/bug_921.py
+++ b/sources/pyside6/tests/QtWidgets/bug_921.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -80,6 +81,8 @@ class TestTimedApp(TimedQApplication):
midleFunction()
self.app.exec()
del w
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
s.s1.emit()
s.s2.emit()
diff --git a/sources/pyside6/tests/QtWidgets/paint_event_test.py b/sources/pyside6/tests/QtWidgets/paint_event_test.py
index 66dd3d084..6bfeade6f 100644
--- a/sources/pyside6/tests/QtWidgets/paint_event_test.py
+++ b/sources/pyside6/tests/QtWidgets/paint_event_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,10 +28,13 @@
'''Test paint event override in python'''
+import gc
import os
import sys
import unittest
+from textwrap import dedent
+
from pathlib import Path
sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
@@ -88,16 +91,26 @@ class PaintEventOverride(UsesQApplication):
def tearDown(self):
# Release resources
del self.widget
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(PaintEventOverride, self).tearDown()
def testPaintEvent(self):
# Test QWidget.paintEvent override
timer_id = self.widget.startTimer(100)
self.widget.show()
- self.app.exec()
+ if hasattr(sys, "pypy_version_info"):
+ # PYSIDE-535: Next line gives millions of
+ orig_exc = dedent("""
+ TypeError: 'PySide6.QtWidgets.QApplication.notify' called with wrong argument types:
+ PySide6.QtWidgets.QApplication.notify(MyWidget, QPainter)
+ Supported signatures:
+ PySide6.QtWidgets.QApplication.notify(PySide6.QtCore.QObject, PySide6.QtCore.QEvent)
+ """)
+ raise SystemError(orig_exc)
+ self.app.exec()
self.widget.killTimer(timer_id)
-
self.assertTrue(self.widget.paint_event_called)
self.assertEqual(self.widget.runs, 5)
diff --git a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
index 57b1e410a..d5327c519 100644
--- a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -46,6 +47,8 @@ class QApplicationDelete(unittest.TestCase):
a = QApplication([])
b = QPushButton('aaaa')
del a
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
index 89caf2906..bb55e5250 100644
--- a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
+++ b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -56,6 +57,8 @@ class DynamicSignalTest(UsesQApplication):
obj.destroyed[QObject].connect(self.cb)
obj = None
del dlg
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self._called)
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
index 4ce395e0e..d2fcbdc9b 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
''' Test cases related to QGraphicsItem and subclasses'''
+import gc
import os
import sys
import unittest
@@ -60,6 +61,8 @@ class QColorOnSetBrush(UsesQApplication):
del self.color
del self.item
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QColorOnSetBrush, self).tearDown()
def testQColor(self):
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
index b8a5a3945..635d1272d 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -87,6 +87,8 @@ class ConstructorWithRect(unittest.TestCase):
def tearDown(self):
# Release resources
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testHeight(self):
# QGraphicsScene.height()
@@ -112,6 +114,8 @@ class AddItem(UsesQApplication):
def tearDown(self):
# Release resources
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(AddItem, self).tearDown()
def testEllipse(self):
@@ -186,6 +190,8 @@ class ItemRetrieve(UsesQApplication):
def tearDown(self):
# Release resources
del self.scene
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(ItemRetrieve, self).tearDown()
def testItems(self):
@@ -213,6 +219,8 @@ class TestGraphicsGroup(UsesQApplication):
group = scene.createItemGroup((i2, i3, i4))
scene.removeItem(i1)
del i1 # this shouldn't delete i2
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(i2.scene(), scene)
scene.destroyItemGroup(group)
self.assertRaises(RuntimeError, group.type)
diff --git a/sources/pyside6/tests/QtWidgets/qlabel_test.py b/sources/pyside6/tests/QtWidgets/qlabel_test.py
index e4b4e9f21..58e5ce544 100644
--- a/sources/pyside6/tests/QtWidgets/qlabel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlabel_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2018 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QLabel'''
+import gc
import os
import sys
import unittest
@@ -54,6 +55,8 @@ class QLabelTest(UsesQApplication):
def tearDown(self):
del self.label
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QLabelTest, self).tearDown()
def testSetPixmap(self):
@@ -77,6 +80,8 @@ class QLabelTest(UsesQApplication):
ret_p_addr = Shiboken.getCppPointer(ret_p)
# Remove the QPixmap
del ret_p
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
# Set new QPixmap
self.label.setPixmap(p2)
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
index e7e61e75a..86c749b08 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QLayout handling of child widgets references'''
+import gc
import os
import sys
import unittest
@@ -61,6 +62,8 @@ class SaveReference(UsesQApplication):
# Release resources
del self.widget2
del self.widget1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(SaveReference, self).tearDown()
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
@@ -132,6 +135,8 @@ class MultipleAdd(UsesQApplication):
del self.widget
del self.layout
del self.win
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(MultipleAdd, self).tearDown()
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_test.py b/sources/pyside6/tests/QtWidgets/qlayout_test.py
index 57855fc05..2f53fcbff 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -145,6 +146,8 @@ class QLayoutTest(UsesQApplication):
QTimer.singleShot(10, w.close)
self.app.exec()
del w
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, spacer.isEmpty)
diff --git a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
index 5bfdcf496..0adc0d0a4 100644
--- a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -47,6 +48,8 @@ class QListWidgetItemConstructor(UsesQApplication):
def tearDown(self):
del self.widgetList
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QListWidgetItemConstructor, self).tearDown()
def testConstructorWithParent(self):
diff --git a/sources/pyside6/tests/QtWidgets/qmenu_test.py b/sources/pyside6/tests/QtWidgets/qmenu_test.py
index 0033cd35d..05990e658 100644
--- a/sources/pyside6/tests/QtWidgets/qmenu_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmenu_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -50,6 +51,8 @@ class QMenuAddAction(UsesQApplication):
def tearDown(self):
del self.menu
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QMenuAddAction, self).tearDown()
def testAddActionWithoutKeySequenceCallable(self):
@@ -76,6 +79,8 @@ class QMenuAddActionWithIcon(UsesQApplication):
def tearDown(self):
del self.menu
del self.icon
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QMenuAddActionWithIcon, self).tearDown()
def testAddActionWithoutKeySequenceCallable(self):
diff --git a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py b/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
index 97fe18119..df052544f 100644
--- a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -51,6 +52,8 @@ class QStandardItemModelTest(UsesQApplication):
def tearDown(self):
del self.window
del self.model
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QStandardItemModelTest, self).tearDown()
def testInsertRow(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
index aeccf6118..8c56936e4 100644
--- a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -51,6 +52,8 @@ class RemoveTabMethod(TimedQApplication):
def tearDown(self):
del self.tab
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
TimedQApplication.tearDown(self)
def testRemoveTabPresence(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
index 3f86c3f98..e4c59d148 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for QToolbar'''
+import gc
import os
import sys
import unittest
@@ -58,6 +59,8 @@ class AddActionText(UsesQApplication):
super(AddActionText, self).tearDown()
del self.toolbar
del self.window
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testText(self):
# QToolBar.addAction(text) - add a QToolButton
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
index 79c447fd7..38000b875 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -49,6 +50,8 @@ class OwnershipControl(UsesQApplication):
def tearDown(self):
del self.toolbox
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(OwnershipControl, self).tearDown()
def testAddItem(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtreeview_test.py b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
index fbbbd6cef..fc721415f 100644
--- a/sources/pyside6/tests/QtWidgets/qtreeview_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2018 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -76,6 +77,8 @@ class QWidgetTest(UsesQApplication):
# This raised the Segmentation Fault too, because manually destroying
# the object caused a missing refrence.
del d
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
# Getting the delegates
a = t.itemDelegateForColumn(0)
diff --git a/sources/pyside6/tests/QtWidgets/qvariant_test.py b/sources/pyside6/tests/QtWidgets/qvariant_test.py
index 2907fb966..9ea0a0de5 100644
--- a/sources/pyside6/tests/QtWidgets/qvariant_test.py
+++ b/sources/pyside6/tests/QtWidgets/qvariant_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -73,6 +74,8 @@ class QGraphicsSceneOnQVariantTest(UsesQApplication):
del self.s
del self.i
del self.combo
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(QGraphicsSceneOnQVariantTest, self).tearDown()
def testIt(self):
diff --git a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
index c22648551..fdfe2f244 100644
--- a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
+++ b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for overriding inherited protected virtual methods'''
+import gc
import os
import sys
import unittest
@@ -83,6 +84,8 @@ class TimerEventTest(UsesQApplication):
def tearDown(self):
# Release resources
del self.widget
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(TimerEventTest, self).tearDown()
def testMethod(self):
diff --git a/sources/pyside6/tests/QtXml/qdomdocument_test.py b/sources/pyside6/tests/QtXml/qdomdocument_test.py
index a02062496..cb42b3081 100644
--- a/sources/pyside6/tests/QtXml/qdomdocument_test.py
+++ b/sources/pyside6/tests/QtXml/qdomdocument_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -63,6 +64,8 @@ class QDomDocumentTest(unittest.TestCase):
del self.dom
del self.goodXmlData
del self.badXmlData
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testQDomDocumentSetContentWithBadXmlData(self):
'''Sets invalid xml as the QDomDocument contents.'''
diff --git a/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py b/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py
index b29d37fc2..b298f9b91 100644
--- a/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py
+++ b/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -53,6 +54,8 @@ class HomonymousSignalAndMethodTest(unittest.TestCase):
del self.value
del self.called
del self.obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testIdValueSignalEmission(self):
def callback(idValue):
diff --git a/sources/pyside6/tests/pysidetest/notify_id.py b/sources/pyside6/tests/pysidetest/notify_id.py
index f11eacdda..1a036da53 100644
--- a/sources/pyside6/tests/pysidetest/notify_id.py
+++ b/sources/pyside6/tests/pysidetest/notify_id.py
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -71,6 +72,8 @@ class NotifyIdSignal(unittest.TestCase):
def tearDown(self):
del self.obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testSignalEmission(self):
metaObject = self.obj.metaObject()
diff --git a/sources/pyside6/tests/pysidetest/property_python_test.py b/sources/pyside6/tests/pysidetest/property_python_test.py
index baf4cdb01..1628be2d4 100644
--- a/sources/pyside6/tests/pysidetest/property_python_test.py
+++ b/sources/pyside6/tests/pysidetest/property_python_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -39,6 +39,7 @@ This test is to ensure maximum compatibility.
# Test case for property
# more tests are in test_descr
+import gc
import os
import sys
import unittest
@@ -95,6 +96,8 @@ class BaseClass(QObject):
@spam.deleter
def spam(self):
del self._spam
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
class SubClass(BaseClass):
diff --git a/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py b/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py
index 99c1a3e91..d59cb7256 100644
--- a/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py
+++ b/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -56,6 +57,8 @@ class SignalEmissionFromPython(unittest.TestCase):
del self.obj2
del self.one_called
del self.two_called
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testConnectNewStyleEmitVoidSignal(self):
def callbackOne():
diff --git a/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py b/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py
index 458a87528..28bc6313b 100644
--- a/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py
+++ b/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -54,6 +55,8 @@ class SignalWithDefaultValueTest(unittest.TestCase):
del self.obj
del self.void_called
del self.bool_called
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testConnectNewStyleEmitVoidSignal(self):
def callbackVoid():
diff --git a/sources/pyside6/tests/signals/invalid_callback_test.py b/sources/pyside6/tests/signals/invalid_callback_test.py
index 5933aee2e..0e4fba279 100644
--- a/sources/pyside6/tests/signals/invalid_callback_test.py
+++ b/sources/pyside6/tests/signals/invalid_callback_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Test cases for passing invalid callbacks to QObject.connect'''
+import gc
import os
import sys
import unittest
@@ -53,6 +54,8 @@ class InvalidCallback(unittest.TestCase):
del self.obj
except AttributeError:
pass
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testIntegerCb(self):
# Test passing an int as callback to QObject.connect
diff --git a/sources/pyside6/tests/signals/pysignal_test.py b/sources/pyside6/tests/signals/pysignal_test.py
index cd7e5f145..030707149 100644
--- a/sources/pyside6/tests/signals/pysignal_test.py
+++ b/sources/pyside6/tests/signals/pysignal_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -123,6 +124,8 @@ class PythonSigSlot(unittest.TestCase):
del self.args
except:
pass
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def callback(self, *args):
if tuple(self.args) == args:
@@ -174,6 +177,8 @@ if hasQtGui:
super(SpinBoxPySignal, self).tearDown()
del self.obj
del self.spin
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testValueChanged(self):
"""Emission of a python signal to QSpinBox setValue(int)"""
@@ -208,6 +213,8 @@ if hasQtGui:
super(WidgetPySignal, self).tearDown()
del self.obj
del self.widget
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testShow(self):
"""Emission of a python signal to QWidget slot show()"""
diff --git a/sources/pyside6/tests/signals/qobject_destroyed_test.py b/sources/pyside6/tests/signals/qobject_destroyed_test.py
index f722e4c2a..204ab5693 100644
--- a/sources/pyside6/tests/signals/qobject_destroyed_test.py
+++ b/sources/pyside6/tests/signals/qobject_destroyed_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -52,6 +53,8 @@ class QObjectDestroyed(unittest.TestCase):
obj = QObject()
obj.destroyed.connect(self.destroyed_cb)
del obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self.called)
diff --git a/sources/pyside6/tests/signals/qobject_receivers_test.py b/sources/pyside6/tests/signals/qobject_receivers_test.py
index e444413e3..27215c7da 100644
--- a/sources/pyside6/tests/signals/qobject_receivers_test.py
+++ b/sources/pyside6/tests/signals/qobject_receivers_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
''' Test case for QObject.receivers()'''
+import gc
import os
import sys
import unittest
@@ -63,6 +64,8 @@ class TestQObjectReceivers(unittest.TestCase):
del receiver2
del receiver1
del sender
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testPySlots(self):
sender = QObject()
@@ -73,6 +76,8 @@ class TestQObjectReceivers(unittest.TestCase):
self.assertEqual(sender.receivers(SIGNAL("destroyed()")), 2)
del sender
del receiver
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testPySignals(self):
sender = QObject()
diff --git a/sources/pyside6/tests/signals/ref01_test.py b/sources/pyside6/tests/signals/ref01_test.py
index bce0e8264..802a33149 100644
--- a/sources/pyside6/tests/signals/ref01_test.py
+++ b/sources/pyside6/tests/signals/ref01_test.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -48,6 +49,8 @@ class BoundAndUnboundSignalsTest(unittest.TestCase):
def tearDown(self):
del self.methods
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testUnboundSignal(self):
self.assertEqual(type(QObject.destroyed), Signal)
diff --git a/sources/pyside6/tests/signals/ref02_test.py b/sources/pyside6/tests/signals/ref02_test.py
index 922a50e46..6b5216080 100644
--- a/sources/pyside6/tests/signals/ref02_test.py
+++ b/sources/pyside6/tests/signals/ref02_test.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -52,6 +53,8 @@ class NativeSignalsTest(UsesQCoreApplication):
def tearDown(self):
del self.called
del self.timeline
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def testSignalWithIntArgument(self):
diff --git a/sources/pyside6/tests/signals/ref03_test.py b/sources/pyside6/tests/signals/ref03_test.py
index 8274c9439..a0ff927b8 100644
--- a/sources/pyside6/tests/signals/ref03_test.py
+++ b/sources/pyside6/tests/signals/ref03_test.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -48,6 +49,8 @@ class DisconnectSignalsTest(unittest.TestCase):
def tearDown(self):
del self.emitter
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testConnectionRefCount(self):
diff --git a/sources/pyside6/tests/signals/ref04_test.py b/sources/pyside6/tests/signals/ref04_test.py
index 9d3103ea7..19eabe2db 100644
--- a/sources/pyside6/tests/signals/ref04_test.py
+++ b/sources/pyside6/tests/signals/ref04_test.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -58,6 +59,8 @@ class UserSignalTest(unittest.TestCase):
def tearDown(self):
del self.emitter
del self.counter
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testConnectEmitDisconnect(self):
diff --git a/sources/pyside6/tests/signals/ref05_test.py b/sources/pyside6/tests/signals/ref05_test.py
index 38c06ce1c..efd5f1b13 100644
--- a/sources/pyside6/tests/signals/ref05_test.py
+++ b/sources/pyside6/tests/signals/ref05_test.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -63,6 +64,8 @@ class UserSlotTest(UsesQCoreApplication):
def tearDown(self):
del self.timeline
del self.receiver
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def testUserSlot(self):
diff --git a/sources/pyside6/tests/signals/ref06_test.py b/sources/pyside6/tests/signals/ref06_test.py
index c0d8c2a91..920b792f9 100644
--- a/sources/pyside6/tests/signals/ref06_test.py
+++ b/sources/pyside6/tests/signals/ref06_test.py
@@ -3,7 +3,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -64,6 +65,8 @@ class SignaltoSignalTest(UsesQCoreApplication):
def tearDown(self):
del self.timeline
del self.receiver
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
UsesQCoreApplication.tearDown(self)
def testSignaltoSignal(self):
diff --git a/sources/pyside6/tests/signals/segfault_proxyparent_test.py b/sources/pyside6/tests/signals/segfault_proxyparent_test.py
index 4a8dd0d19..52df9accf 100644
--- a/sources/pyside6/tests/signals/segfault_proxyparent_test.py
+++ b/sources/pyside6/tests/signals/segfault_proxyparent_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -70,6 +71,8 @@ class SegfaultCase(unittest.TestCase):
del self.args
except:
pass
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def callback(self, *args):
if tuple(self.args) == args:
@@ -83,6 +86,8 @@ class SegfaultCase(unittest.TestCase):
obj.emit(SIGNAL('bar(int)'), self.args[0])
self.assertTrue(self.called)
del obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
obj = Joe()
QObject.connect(obj, SIGNAL('bar(int)'), self.callback)
diff --git a/sources/pyside6/tests/signals/short_circuit_test.py b/sources/pyside6/tests/signals/short_circuit_test.py
index d0f45891d..031fe3d60 100644
--- a/sources/pyside6/tests/signals/short_circuit_test.py
+++ b/sources/pyside6/tests/signals/short_circuit_test.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -53,6 +54,8 @@ class ShortCircuitSignals(unittest.TestCase):
del self.args
except:
pass
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def callback(self, *args):
if tuple(self.args) == args:
diff --git a/sources/pyside6/tests/signals/signal2signal_connect_test.py b/sources/pyside6/tests/signals/signal2signal_connect_test.py
index 05a6b6e72..2fecd39e0 100644
--- a/sources/pyside6/tests/signals/signal2signal_connect_test.py
+++ b/sources/pyside6/tests/signals/signal2signal_connect_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
''' Test case for signal to signal connections.'''
+import gc
import os
import sys
import unittest
@@ -67,6 +68,8 @@ class TestSignal2SignalConnect(unittest.TestCase):
except:
pass
del self.args
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def callback_noargs(self):
# Default callback without arguments
@@ -92,6 +95,8 @@ class TestSignal2SignalConnect(unittest.TestCase):
QObject.connect(self.forwarder, SIGNAL("forward()"),
self.callback_noargs)
del self.sender
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self.called)
def testSignalWithOnePrimitiveTypeArgument(self):
@@ -131,6 +136,8 @@ class TestSignal2SignalConnect(unittest.TestCase):
self.sender.setObjectName(obj_name)
self.args = (obj_name, )
del self.sender
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self.called)
diff --git a/sources/pyside6/tests/signals/signal_emission_gui_test.py b/sources/pyside6/tests/signals/signal_emission_gui_test.py
index cf9ddb543..3f9549de1 100644
--- a/sources/pyside6/tests/signals/signal_emission_gui_test.py
+++ b/sources/pyside6/tests/signals/signal_emission_gui_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
"""Tests covering signal emission and receiving to python slots"""
+import gc
import os
import sys
import unittest
@@ -81,6 +82,8 @@ if hasQtGui:
def tearDown(self):
del self.spin
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(SpinBoxPySlot, self).tearDown()
def testSpinBoxValueChanged(self):
diff --git a/sources/pyside6/tests/signals/static_metaobject_test.py b/sources/pyside6/tests/signals/static_metaobject_test.py
index dbb3aecfa..d9f339df0 100644
--- a/sources/pyside6/tests/signals/static_metaobject_test.py
+++ b/sources/pyside6/tests/signals/static_metaobject_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -30,6 +30,7 @@
"""Tests covering signal emission and receiving to python slots"""
+import gc
import os
import sys
import unittest
@@ -73,6 +74,8 @@ class StaticMetaObjectTest(UsesQCoreApplication):
del o
del o2
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
o = MyObject()
# The SIGNAL was destroyed with old objects
self.assertEqual(o.metaObject().indexOfSignal("foo()"), -1)
@@ -86,6 +89,8 @@ class StaticMetaObjectTest(UsesQCoreApplication):
o.emit(SIGNAL("foo2()"))
self.assertEqual(m._slotCalledCount, 1)
del o
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
m.emit(SIGNAL("foo2()"))
self.assertEqual(m._slotCalledCount, 2)
diff --git a/sources/pyside6/tests/util/helper/basicpyslotcase.py b/sources/pyside6/tests/util/helper/basicpyslotcase.py
index 511db8e08..25a334bd9 100644
--- a/sources/pyside6/tests/util/helper/basicpyslotcase.py
+++ b/sources/pyside6/tests/util/helper/basicpyslotcase.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,8 @@
##
#############################################################################
+import gc
+
class BasicPySlotCase(object):
'''Base class that tests python slots and signal emissions.
@@ -40,6 +42,8 @@ class BasicPySlotCase(object):
del self.args
except:
pass
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def cb(self, *args):
'''Simple callback with arbitrary arguments.
diff --git a/sources/pyside6/tests/util/helper/timedqapplication.py b/sources/pyside6/tests/util/helper/timedqapplication.py
index f172878ef..48e44c737 100644
--- a/sources/pyside6/tests/util/helper/timedqapplication.py
+++ b/sources/pyside6/tests/util/helper/timedqapplication.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Helper classes and functions'''
+import gc
import unittest
from PySide6.QtCore import QTimer
@@ -47,3 +48,5 @@ class TimedQApplication(unittest.TestCase):
def tearDown(self):
'''Delete resources'''
del self.app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
diff --git a/sources/pyside6/tests/util/helper/usesqapplication.py b/sources/pyside6/tests/util/helper/usesqapplication.py
index abb2ca238..bfc1e3ce6 100644
--- a/sources/pyside6/tests/util/helper/usesqapplication.py
+++ b/sources/pyside6/tests/util/helper/usesqapplication.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Helper classes and functions'''
+import gc
import unittest
from PySide6.QtWidgets import QApplication
@@ -48,4 +49,6 @@ class UsesQApplication(unittest.TestCase):
def tearDown(self):
'''Deletes the reference owned by self'''
del self.app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(UsesQApplication, self).tearDown()
diff --git a/sources/pyside6/tests/util/helper/usesqcoreapplication.py b/sources/pyside6/tests/util/helper/usesqcoreapplication.py
index 9f4a4280d..24399f3ed 100644
--- a/sources/pyside6/tests/util/helper/usesqcoreapplication.py
+++ b/sources/pyside6/tests/util/helper/usesqcoreapplication.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Helper classes and functions'''
+import gc
import unittest
from PySide6.QtCore import QCoreApplication
@@ -53,6 +54,8 @@ class UsesQCoreApplication(unittest.TestCase):
def tearDown(self):
'''Release resources'''
del self.app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def exit_app_cb(self):
'''Quits the application'''
diff --git a/sources/pyside6/tests/util/helper/usesqguiapplication.py b/sources/pyside6/tests/util/helper/usesqguiapplication.py
index 65c4f4939..3d2af6d5c 100644
--- a/sources/pyside6/tests/util/helper/usesqguiapplication.py
+++ b/sources/pyside6/tests/util/helper/usesqguiapplication.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -28,6 +28,7 @@
'''Helper classes and functions'''
+import gc
import unittest
from PySide6.QtGui import QGuiApplication
@@ -46,4 +47,6 @@ class UsesQGuiApplication(unittest.TestCase):
def tearDown(self):
'''Deletes the reference owned by self'''
del self.app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
super(UsesQGuiApplication, self).tearDown()
diff --git a/sources/shiboken6/tests/otherbinding/otherderived_test.py b/sources/shiboken6/tests/otherbinding/otherderived_test.py
index 9a68e2ad4..946f82121 100644
--- a/sources/shiboken6/tests/otherbinding/otherderived_test.py
+++ b/sources/shiboken6/tests/otherbinding/otherderived_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Test cases for OtherDerived class'''
+import gc
import os
import sys
import unittest
@@ -75,6 +76,8 @@ class MultipleTest(unittest.TestCase):
self.assertTrue(isinstance(o, Number))
self.assertTrue(isinstance(o, Derived))
del o
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testMethodCall(self):
o = Multiple()
diff --git a/sources/shiboken6/tests/samplebinding/__del___test.py b/sources/shiboken6/tests/samplebinding/__del___test.py
index 146e6e409..829aa3ec6 100644
--- a/sources/shiboken6/tests/samplebinding/__del___test.py
+++ b/sources/shiboken6/tests/samplebinding/__del___test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -51,6 +52,8 @@ class TestDel(unittest.TestCase):
def testIt(self):
a = MyObject()
del a
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(delCalled)
if __name__ == '__main__':
diff --git a/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py b/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py
index 86d0a4731..8cdcc1d0d 100644
--- a/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py
+++ b/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Test cases for method arguments modifications performed as described on typesystem.'''
+import gc
import os
import sys
import unittest
@@ -50,6 +51,8 @@ class ArgumentModificationsTest(unittest.TestCase):
def tearDown(self):
del self.mods
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testArgRemoval0(self):
'''Tests argument removal modifications on Modifications.argRemoval0.'''
diff --git a/sources/shiboken6/tests/samplebinding/child_return_test.py b/sources/shiboken6/tests/samplebinding/child_return_test.py
index 4b9a18e7b..1f5fd809b 100644
--- a/sources/shiboken6/tests/samplebinding/child_return_test.py
+++ b/sources/shiboken6/tests/samplebinding/child_return_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''The BlackBox class has cases of ownership transference between C++ and Python.'''
+import gc
import os
import sys
import unittest
@@ -50,6 +51,8 @@ class ReturnOfChildTest(unittest.TestCase):
o1 = ObjectType.createWithChild()
child = o1.children()[0]
del o1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, child.objectName)
def testKillParentKeepingChild2(self):
@@ -57,6 +60,8 @@ class ReturnOfChildTest(unittest.TestCase):
o1 = ObjectType.createWithChild()
child = o1.findChild("child")
del o1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, child.objectName)
if __name__ == '__main__':
diff --git a/sources/shiboken6/tests/samplebinding/cyclic_test.py b/sources/shiboken6/tests/samplebinding/cyclic_test.py
index 5a20216b6..11e346297 100644
--- a/sources/shiboken6/tests/samplebinding/cyclic_test.py
+++ b/sources/shiboken6/tests/samplebinding/cyclic_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -29,6 +29,7 @@
##
#############################################################################
+import gc
import os
import sys
import unittest
@@ -50,8 +51,6 @@ class ObjTest(unittest.TestCase):
only be removed by the garbage collector, and then invoke the
garbage collector in a different thread.
"""
- import gc
-
class CyclicChildObject(ObjectType):
def __init__(self, parent):
super(CyclicChildObject, self).__init__(parent)
@@ -74,7 +73,9 @@ class ObjTest(unittest.TestCase):
cycle = CyclicObject()
self.assertTrue(alive())
del cycle
- self.assertTrue(alive())
+ if not hasattr(sys, "pypy_version_info"):
+ # PYSIDE-535: the semantics of gc.enable/gc.disable is different for PyPy
+ self.assertTrue(alive())
gc.collect()
self.assertFalse(alive())
@@ -83,8 +84,6 @@ class ObjTest(unittest.TestCase):
only be removed by the garbage collector, and then invoke the
garbage collector in a different thread.
"""
- import gc
-
class CyclicChildObject(ObjectView):
def __init__(self, model):
super(CyclicChildObject, self).__init__(None)
@@ -107,7 +106,9 @@ class ObjTest(unittest.TestCase):
cycle = CyclicObject()
self.assertTrue(alive())
del cycle
- self.assertTrue(alive())
+ if not hasattr(sys, "pypy_version_info"):
+ # PYSIDE-535: the semantics of gc.enable/gc.disable is different for PyPy
+ self.assertTrue(alive())
gc.collect()
self.assertFalse(alive())
diff --git a/sources/shiboken6/tests/samplebinding/modifications_test.py b/sources/shiboken6/tests/samplebinding/modifications_test.py
index 3429ccd0f..f67614c98 100644
--- a/sources/shiboken6/tests/samplebinding/modifications_test.py
+++ b/sources/shiboken6/tests/samplebinding/modifications_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Test cases for method modifications performed as described on type system. '''
+import gc
import os
import sys
import unittest
@@ -64,6 +65,8 @@ class ModificationsTest(unittest.TestCase):
def tearDown(self):
del self.mods
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testClassMembersAvailability(self):
'''Test if Modified class really have the expected members.'''
diff --git a/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py b/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py
index b59e64a00..538488396 100644
--- a/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py
+++ b/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py
@@ -31,6 +31,7 @@
'''Test cases for modified virtual methods.'''
+import gc
import os
import sys
import unittest
@@ -100,6 +101,8 @@ class VirtualMethodsTest(unittest.TestCase):
def tearDown(self):
del self.vm
del self.evm
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testModifiedVirtualMethod0(self):
'''Renamed virtual method.'''
diff --git a/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py b/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py
index 10b2f0ca9..ff7a25ea4 100644
--- a/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py
+++ b/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Tests cases for ObjectTypeLayout class.'''
+import gc
import os
import sys
import unittest
@@ -84,6 +85,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
p1.setLayout(layout)
del p1 # This must kill c1, c2 and c3
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, c1.objectName)
self.assertRaises(RuntimeError, c2.objectName)
@@ -106,6 +109,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
p1.setLayout(layout)
del p1 # This must kill c1, c2 and c3
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, c1.objectName)
self.assertRaises(RuntimeError, c2.objectName)
@@ -165,6 +170,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
self.assertEqual(l2.parent(), l1)
del p1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, c1.objectName)
self.assertRaises(RuntimeError, c2.objectName)
@@ -201,6 +208,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
self.assertEqual(l2.parent(), l1)
del p1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, c1.objectName)
self.assertRaises(RuntimeError, c2.objectName)
@@ -239,6 +248,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
p2.setLayout(l1)
del p1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(c1.parent(), p2)
self.assertEqual(c2.parent(), p2)
@@ -248,6 +259,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
self.assertEqual(l2.parent(), l1)
del p2
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, c1.objectName)
self.assertRaises(RuntimeError, c2.objectName)
@@ -287,6 +300,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
p2.setLayout(l1)
del p1
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(c1.parent(), p2)
self.assertEqual(c2.parent(), p2)
@@ -296,6 +311,8 @@ class ObjectTypeLayoutTest(unittest.TestCase):
self.assertEqual(l2.parent(), l1)
del p2
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, c1.objectName)
self.assertRaises(RuntimeError, c2.objectName)
diff --git a/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py b/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py
index 10535f272..d33e784f1 100644
--- a/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py
+++ b/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Tests for deleting a child object in python'''
+import gc
import os
import random
import string
@@ -56,6 +57,8 @@ class DeleteChildInPython(unittest.TestCase):
child.setObjectName(name)
del child
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
new_child = parent.children()[0]
self.assertEqual(new_child.objectName(), name)
diff --git a/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py b/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py
index 310bf08ee..4b20affda 100644
--- a/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py
+++ b/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Tests for destroying the parent'''
+import gc
import os
import sys
import unittest
@@ -56,6 +57,8 @@ class DeleteParentTest(unittest.TestCase):
refcount_before = sys.getrefcount(child)
del parent
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, child.objectName)
self.assertEqual(sys.getrefcount(child), refcount_before-1)
@@ -69,6 +72,8 @@ class DeleteParentTest(unittest.TestCase):
child.setParent(parent)
del parent
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
for i, child in enumerate(children):
self.assertRaises(RuntimeError, child.objectName)
self.assertEqual(sys.getrefcount(child), 4)
@@ -81,6 +86,8 @@ class DeleteParentTest(unittest.TestCase):
grandchild = ObjectType(child)
del parent
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, child.objectName)
self.assertEqual(sys.getrefcount(child), 2)
self.assertRaises(RuntimeError, grandchild.objectName)
diff --git a/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py b/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py
index 6ffa6629b..7d45462b6 100644
--- a/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py
+++ b/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Tests for invalidating a C++ created child that was already on the care of a parent.'''
+import gc
import os
import sys
import unittest
@@ -67,6 +68,8 @@ class InvalidateChildTest(unittest.TestCase):
self.assertEqual(parent.children(), [])
del parent
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(child1.objectName(), 'child1')
self.assertRaises(RuntimeError, child2.objectName)
diff --git a/sources/shiboken6/tests/samplebinding/ownership_transference_test.py b/sources/shiboken6/tests/samplebinding/ownership_transference_test.py
index 9d9492e29..541d2fca0 100644
--- a/sources/shiboken6/tests/samplebinding/ownership_transference_test.py
+++ b/sources/shiboken6/tests/samplebinding/ownership_transference_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''The BlackBox class has cases of ownership transference between C++ and Python.'''
+import gc
import os
import sys
import unittest
@@ -65,6 +66,8 @@ class BlackBoxTest(unittest.TestCase):
o2 = bb.retrieveObjectType(o2_ticket)
self.assertEqual(sys.getrefcount(o2), o2_refcnt)
del bb
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertRaises(RuntimeError, o1.objectName)
self.assertEqual(str(o2.objectName()), 'object2')
self.assertEqual(sys.getrefcount(o2), o2_refcnt)
diff --git a/sources/shiboken6/tests/samplebinding/protected_test.py b/sources/shiboken6/tests/samplebinding/protected_test.py
index 096eb615d..aaac495cf 100644
--- a/sources/shiboken6/tests/samplebinding/protected_test.py
+++ b/sources/shiboken6/tests/samplebinding/protected_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Test cases for protected methods.'''
+import gc
import os
import sys
import unittest
@@ -187,7 +188,11 @@ class ProtectedVirtualDtorTest(unittest.TestCase):
dtor_called = ProtectedVirtualDestructor.dtorCalled()
for i in range(1, 10):
pvd = ProtectedVirtualDestructor()
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
del pvd
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(ProtectedVirtualDestructor.dtorCalled(), dtor_called + i)
def testVirtualProtectedDtorOnCppCreatedObject(self):
@@ -196,6 +201,8 @@ class ProtectedVirtualDtorTest(unittest.TestCase):
for i in range(1, 10):
pvd = ProtectedVirtualDestructor.create()
del pvd
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(ProtectedVirtualDestructor.dtorCalled(), dtor_called + i)
def testProtectedDtorOnDerivedClass(self):
@@ -204,6 +211,8 @@ class ProtectedVirtualDtorTest(unittest.TestCase):
for i in range(1, 10):
pvd = ExtendedProtectedVirtualDestructor()
del pvd
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(ExtendedProtectedVirtualDestructor.dtorCalled(), dtor_called + i)
@@ -282,6 +291,8 @@ class ProtectedPropertyTest(unittest.TestCase):
def tearDown(self):
del self.obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(cacheSize(), 0)
def testProtectedProperty(self):
@@ -323,6 +334,8 @@ class ProtectedPropertyTest(unittest.TestCase):
pointProperty = obj.protectedValueTypeProperty
self.assertTrue(obj.protectedValueTypeProperty is pointProperty)
del obj, point, pointProperty
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(cacheSize(), cache_size)
def testProtectedValueTypePointerProperty(self):
diff --git a/sources/shiboken6/tests/samplebinding/typedealloc_test.py b/sources/shiboken6/tests/samplebinding/typedealloc_test.py
index 32a15e300..10f66cba7 100644
--- a/sources/shiboken6/tests/samplebinding/typedealloc_test.py
+++ b/sources/shiboken6/tests/samplebinding/typedealloc_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -52,6 +52,8 @@ class TypeDeallocTest(unittest.TestCase):
def tearDown(self):
del self.called
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def callback(self, *args):
self.called = True
diff --git a/sources/shiboken6/tests/samplebinding/virtualdtor_test.py b/sources/shiboken6/tests/samplebinding/virtualdtor_test.py
index 8f29eca3c..7a94f21d2 100644
--- a/sources/shiboken6/tests/samplebinding/virtualdtor_test.py
+++ b/sources/shiboken6/tests/samplebinding/virtualdtor_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Test cases for virtual destructor.'''
+import gc
import os
import sys
import unittest
@@ -58,6 +59,8 @@ class VirtualDtorTest(unittest.TestCase):
for i in range(1, 10):
vd = VirtualDtor()
del vd
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(VirtualDtor.dtorCalled(), dtor_called + i)
def testVirtualDtorOnCppCreatedObject(self):
@@ -66,6 +69,8 @@ class VirtualDtorTest(unittest.TestCase):
for i in range(1, 10):
vd = VirtualDtor.create()
del vd
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(VirtualDtor.dtorCalled(), dtor_called + i)
def testDtorOnDerivedClass(self):
@@ -74,6 +79,8 @@ class VirtualDtorTest(unittest.TestCase):
for i in range(1, 10):
evd = ExtendedVirtualDtor()
del evd
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(ExtendedVirtualDtor.dtorCalled(), dtor_called + i)
diff --git a/sources/shiboken6/tests/samplebinding/virtualmethods_test.py b/sources/shiboken6/tests/samplebinding/virtualmethods_test.py
index 1c842993c..67220071e 100644
--- a/sources/shiboken6/tests/samplebinding/virtualmethods_test.py
+++ b/sources/shiboken6/tests/samplebinding/virtualmethods_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Test cases for virtual methods.'''
+import gc
import os
import sys
import unittest
@@ -88,6 +89,8 @@ class VirtualMethodsTest(unittest.TestCase):
def tearDown(self):
del self.prefix_from_codeinjection
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
def testReimplementedVirtualMethod0(self):
'''Test Python override of a virtual method with various different parameters is correctly called from C++.'''
diff --git a/sources/shiboken6/tests/samplebinding/weakref_test.py b/sources/shiboken6/tests/samplebinding/weakref_test.py
index 6ca031c0d..03d99979a 100644
--- a/sources/shiboken6/tests/samplebinding/weakref_test.py
+++ b/sources/shiboken6/tests/samplebinding/weakref_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -31,6 +31,7 @@
'''Test weakref support'''
+import gc
import os
import sys
import unittest
@@ -58,6 +59,8 @@ class WeakrefBasicTest(unittest.TestCase):
obj = ObjectType()
ref = weakref.ref(obj, self.cb)
del obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self.called)
def testPrivateDtor(self):
@@ -65,6 +68,8 @@ class WeakrefBasicTest(unittest.TestCase):
obj = PrivateDtor.instance()
ref = weakref.ref(obj, self.cb)
del obj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertTrue(self.called)
diff --git a/sources/shiboken6/tests/smartbinding/smart_pointer_test.py b/sources/shiboken6/tests/smartbinding/smart_pointer_test.py
index 1bdce333e..10e761149 100644
--- a/sources/shiboken6/tests/smartbinding/smart_pointer_test.py
+++ b/sources/shiboken6/tests/smartbinding/smart_pointer_test.py
@@ -3,7 +3,7 @@
#
#############################################################################
##
-## Copyright (C) 2017 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -99,10 +99,14 @@ class SmartPointerTests(unittest.TestCase):
# Delete the first shared pointer, object count should not change because the second
# one still has a reference.
del ptrToObj
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(objCount(), 1)
# Delete the second smart pointer, object should be deleted.
del ptrToObj2
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(objCount(), 0)
self.assertEqual(integerCount(), 0)
@@ -146,15 +150,21 @@ class SmartPointerTests(unittest.TestCase):
# Delete the first shared pointer, integer count should not change because the second
# one still has a reference.
del ptrToInteger
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(integerCount(), 2)
# Delete the second smart pointer, integer should be deleted.
del ptrToInteger2
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(objCount(), 1)
self.assertEqual(integerCount(), 1)
# Delete the original object which was used to create the integer.
del o
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(objCount(), 0)
self.assertEqual(integerCount(), 0)
@@ -199,6 +209,8 @@ class SmartPointerTests(unittest.TestCase):
# clear and delete all objects in the list
del ptrToObjList[:] # Python 2.7 lists have no clear method
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
self.assertEqual(len(ptrToObjList), 0)
self.assertEqual(objCount(), 1)