aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtWidgets
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-10-25 19:22:33 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-27 14:28:53 +0000
commitf02623461d6f8a0d9803e49d3f8928bf78ad7d6d (patch)
tree25a5f456e1243fb154568856603428b6a8f6d257 /sources/pyside6/tests/QtWidgets
parent587b6d15411debf979f2e4e06372e596409eadda (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 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit c7c789b1822fe0b2e77e66e5c1a66a16b3c3c405) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'sources/pyside6/tests/QtWidgets')
-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
22 files changed, 111 insertions, 25 deletions
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):