aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-08-06 12:52:33 +0200
committerChristian Tismer <tismer@stackless.com>2019-08-06 18:53:13 +0200
commit21d948aa47dfe62b58286a31c729e76c9e3c13db (patch)
tree3edbc8b04de200ca2aea5656ff8d2f8d7212a601 /sources/pyside2/tests
parent5838387e31987286ae836135ecd06326f0c7e1ba (diff)
PySide: Create a framework for deprecated functions
During development of the patch "Support Pointer Primitive Types by Arrays or Result Tuples" some functions in QtGui turned out to be removal candidates. The name "constData" should be deprecated in favor of the existing "data" function. Other implementation also do not have this. Instead of simply removing, we now create a surrogate function with the name "constData" in fure Python that gives a warning and calls the "data" function. This is now extracted into its own commit since the deprecation is a completely different and independent issue. The implementation does not do any extra imports in advance. and is easily extensible to more post-installation actions. Task-number: PYSIDE-795 Change-Id: I410c69a87d9f0df78f736991b2ee0a2747678911 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/QtGui/CMakeLists.txt2
-rw-r--r--sources/pyside2/tests/QtGui/timed_app_and_patching_test.py (renamed from sources/pyside2/tests/QtGui/timed_app_test.py)19
2 files changed, 20 insertions, 1 deletions
diff --git a/sources/pyside2/tests/QtGui/CMakeLists.txt b/sources/pyside2/tests/QtGui/CMakeLists.txt
index 927e72468..172703ab9 100644
--- a/sources/pyside2/tests/QtGui/CMakeLists.txt
+++ b/sources/pyside2/tests/QtGui/CMakeLists.txt
@@ -46,4 +46,4 @@ PYSIDE_TEST(qtextdocumentwriter_test.py)
PYSIDE_TEST(qtextline_test.py)
PYSIDE_TEST(qtransform_test.py)
PYSIDE_TEST(repr_test.py)
-PYSIDE_TEST(timed_app_test.py)
+PYSIDE_TEST(timed_app_and_patching_test.py)
diff --git a/sources/pyside2/tests/QtGui/timed_app_test.py b/sources/pyside2/tests/QtGui/timed_app_and_patching_test.py
index dc0e7c4b0..014aeec1a 100644
--- a/sources/pyside2/tests/QtGui/timed_app_test.py
+++ b/sources/pyside2/tests/QtGui/timed_app_and_patching_test.py
@@ -29,6 +29,10 @@
import unittest
from helper import TimedQApplication
+from PySide2.support import deprecated
+from PySide2.support.signature import importhandler
+from PySide2 import QtGui
+
class TestTimedApp(TimedQApplication):
'''Simple test case for TimedQApplication'''
@@ -37,5 +41,20 @@ class TestTimedApp(TimedQApplication):
#Simple test of TimedQApplication
self.app.exec_()
+
+def fix_for_QtGui(QtGui):
+ QtGui.something = 42
+
+class TestPatchingFramework(unittest.TestCase):
+ """Simple test that verifies that deprecated.py works"""
+
+ deprecated.fix_for_QtGui = fix_for_QtGui
+
+ def test_patch_works(self):
+ something = "something"
+ self.assertFalse(hasattr(QtGui, something))
+ importhandler.finish_import(QtGui)
+ self.assertTrue(hasattr(QtGui, something))
+
if __name__ == '__main__':
unittest.main()