diff options
| author | Christian Tismer <tismer@stackless.com> | 2021-10-25 19:22:33 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2021-10-27 14:07:48 +0200 |
| commit | c7c789b1822fe0b2e77e66e5c1a66a16b3c3c405 (patch) | |
| tree | d299b5cce39f42335f03eb4711e5634e2e122aec /sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py | |
| parent | 55eebea1a48cbf5c2caef5b89226ad5c1fb18971 (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/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py')
| -rw-r--r-- | sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py | 8 |
1 files changed, 6 insertions, 2 deletions
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__': |
