aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-01-12 13:04:09 +0100
committerCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2020-01-29 07:48:01 +0100
commit8c5b08a74650e5dea7303d6f232c4df0f706cb35 (patch)
tree265cbde75594202b8f3a9002611eea50b5a77f4a /sources/pyside2/tests
parent3fb91c8759fd8cf13dede5973b5c7ff0535533fa (diff)
Let qApp be noApp instead of pretending to be None
qApp should stay almost as it is with only two cosmetic changes: When qApp's return value has Type(Py_None), the value now reports "noApp" instead of "None". Also the feature of "del __builtins__.qApp" is replaced by function qApp.shutdown() . This makes things easier to explain and avoids refcounting hacks. The embedding problem (Falkon browser) was too complicated. We finally solved it by disabling qApp in embedded mode. Change-Id: I0d99661137130684823aa3d1978b494d8ab08e59 Fixes: PYSIDE-1158 Fixes: PYSIDE-1178 Fixes: PYSIDE-1135 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/QtWidgets/application_test.py9
-rw-r--r--sources/pyside2/tests/QtWidgets/private_mangle_test.py2
-rw-r--r--sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py14
3 files changed, 9 insertions, 16 deletions
diff --git a/sources/pyside2/tests/QtWidgets/application_test.py b/sources/pyside2/tests/QtWidgets/application_test.py
index 0b8f73cd6..efb41684a 100644
--- a/sources/pyside2/tests/QtWidgets/application_test.py
+++ b/sources/pyside2/tests/QtWidgets/application_test.py
@@ -46,10 +46,11 @@ class QApplicationInstance(unittest.TestCase):
app1.setObjectName("MyApp")
self.assertEqual(app1, app2)
self.assertEqual(app2.objectName(), app1.objectName())
- if len(all) > 3:
- # an import triggers qApp initialization
- __import__("PySide2." + all[-1])
- self.assertEqual(app1, qApp)
+ # We no longer support qApp when embedding
+ # if len(all) > 3:
+ # # an import triggers qApp initialization
+ # __import__("PySide2." + all[-1])
+ # self.assertEqual(app1, qApp)
app1.destroyed.connect(self.appDestroyed)
if __name__ == '__main__':
diff --git a/sources/pyside2/tests/QtWidgets/private_mangle_test.py b/sources/pyside2/tests/QtWidgets/private_mangle_test.py
index 31a870691..5ad10c7b3 100644
--- a/sources/pyside2/tests/QtWidgets/private_mangle_test.py
+++ b/sources/pyside2/tests/QtWidgets/private_mangle_test.py
@@ -91,7 +91,7 @@ class TestMangle(unittest.TestCase):
QApplication()
def tearDown(self):
- del QtWidgets.qApp
+ qApp.shutdown()
def testPrivateMangle(self):
harness = Harness()
diff --git a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py b/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py
index 1c0d5d55d..43f455ea9 100644
--- a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py
+++ b/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py
@@ -57,20 +57,12 @@ class qAppMacroTest(unittest.TestCase):
QtWidgets.QApplication)
for klass in classes:
print("created", klass([]))
- del __builtins__.qApp
- print("deleted qApp")
+ qApp.shutdown()
+ print("deleted qApp", qApp)
# creating without deletion raises:
QtCore.QCoreApplication([])
with self.assertRaises(RuntimeError):
QtCore.QCoreApplication([])
- # assigning qApp is obeyed
- QtCore.qApp = 42
- del __builtins__.qApp
- self.assertEqual(QtCore.qApp, 42)
- self.assertNotEqual(__builtins__, 42)
- # delete it and it re-appears
- del QtCore.qApp
- QtCore.QCoreApplication([])
self.assertEqual(QtCore.QCoreApplication.instance(), QtCore.qApp)
# and they are again all the same
self.assertTrue(qApp is QtCore.qApp is QtGui.qApp is QtWidgets.qApp)
@@ -87,7 +79,7 @@ class qAppMacroTest(unittest.TestCase):
if app is None:
app = QtCore.QCoreApplication([])
self.assertTrue(QtCore.QObject.staticMetaObject is not None)
- del __builtins__.qApp
+ qApp.shutdown()
if __name__ == '__main__':