diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-28 11:31:37 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-30 10:40:34 +0100 |
commit | d1868d70f0f5ae38efd532911c5a7e28ebd02752 (patch) | |
tree | aa3ed95f44f4e24181989b596af8790de081202a | |
parent | 6294578f2c6374ec92cde94821f7949b5f8c477b (diff) |
Prospective fix for flaky smart_pointer_test.py
The test has been observed to fail apparently since
the result was not collected.
Traceback (most recent call last)
File "sources/shiboken2/tests/smartbinding/smart_pointer_test.py", line 82, in testObjSmartPointer
self.assertEqual(integerCount(), 1)
AssertionError 2 != 1
File "sources/shiboken2/tests/smartbinding/smart_pointer_test.py", line 154, in testSmartPointersWithNamespace
self.assertEqual(integerCount(), 2)
AssertionError 3 != 2
Enforce a garbage collection to ensure the object is deleted.
Task-number: PYSIDE-454
Change-Id: I85baa059319a5286f94a5607c4de32bfc50ae0e0
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | build_history/blacklist.txt | 4 | ||||
-rw-r--r-- | sources/shiboken2/tests/smartbinding/smart_pointer_test.py | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/build_history/blacklist.txt b/build_history/blacklist.txt index adcf5206d..33c1ba016 100644 --- a/build_history/blacklist.txt +++ b/build_history/blacklist.txt @@ -68,9 +68,7 @@ [QtQml::qquickitem_grabToImage] darwin [smart::smart_pointer] - win32 - linux - darwin + py2 # PYSIDE-474 [QtWebEngineWidgets::pyside-474-qtwebengineview] py2 diff --git a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py index e1883c7cc..b26a3dcbc 100644 --- a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py +++ b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py @@ -29,6 +29,10 @@ ## ############################################################################# +from __future__ import print_function + +import gc +import sys import unittest from copy import copy from smart import Obj, Registry, Integer @@ -79,6 +83,9 @@ class SmartPointerTests(unittest.TestCase): result = ptrToObj.takeInteger(ptrToObj.m_internalInteger) self.assertEqual(integerCount(), 2) result = None + if integerCount() > 1: + gc.collect() + print('Running garbage collector for reference test', file=sys.stderr) self.assertEqual(integerCount(), 1) # Make a copy of the shared pointer, object count should not change. |