aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2018-07-14 15:10:56 +0200
committerChristian Tismer <tismer@stackless.com>2018-11-24 10:31:02 +0000
commitb92fb6e81be252a2ffae26768434028c5029ddc7 (patch)
tree88338bea02faff38ac986ba9d39c24d17670f795 /sources/pyside2/tests
parent4413f505ebcc39882ab7052488b37e38300b5219 (diff)
Split The Signature Module After The Project Split
The PySide project has been split into three pieces, including Shiboken. This had far-reaching consequences for the signature project. Shiboken can be run together with PySide or alone, with tests or without. In every configuration, the signature module has to work correctly. During tests, the shiboken binary also hides the shiboken module, and we had to use extra efforts to always guarantee the accessibility of all signature modules. This commit is the preparation for typeerrors implemented with the signature module. It has been split off because the splitting is not directly related, besides these unawaited consequences. I re-added and corrected voidptr_test and simplified the calls. Remark.. We should rename shiboken to Shiboken in all imports. I also simplified initialization. After "from PySide2 import QtCore", now a simple access like "type.__signature__" triggers initialization. Further, I removed all traces of "signature_loader" and allowed loading everything from PySide2.support.signature, again. The loader is now needed internally, only. Also, moved the type patching into FinishSignatureInitialization to support modules with no classes at all. The "testbinding" problem was finally identified as a name clash when the same function is also a signal. A further investigation showed that there exists also a regular PySide method with that problem. The test was extended to all methods, and it maps now all these cases to "{name}.overload". Updated the included typing27.py from https://pypi.org/project/typing/ from version 3.6.2 to version 3.6.6 . Task-number: PYSIDE-749 Change-Id: Ie33b8c6b0df5640212f8991539088593a041a05c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtWidgets/qlabel_test.py9
-rw-r--r--sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py9
-rw-r--r--sources/pyside2/tests/registry/existence_test.py2
-rw-r--r--sources/pyside2/tests/registry/init_platform.py1
-rw-r--r--sources/pyside2/tests/support/voidptr_test.py4
6 files changed, 6 insertions, 20 deletions
diff --git a/sources/pyside2/tests/CMakeLists.txt b/sources/pyside2/tests/CMakeLists.txt
index 2386950e9..4289012a8 100644
--- a/sources/pyside2/tests/CMakeLists.txt
+++ b/sources/pyside2/tests/CMakeLists.txt
@@ -54,6 +54,7 @@ else()
endif()
add_subdirectory(registry)
add_subdirectory(signals)
+ add_subdirectory(support)
foreach(shortname IN LISTS all_module_shortnames)
message(STATUS "preparing tests for module 'Qt${shortname}'")
diff --git a/sources/pyside2/tests/QtWidgets/qlabel_test.py b/sources/pyside2/tests/QtWidgets/qlabel_test.py
index 2c5616001..9d84b5c17 100644
--- a/sources/pyside2/tests/QtWidgets/qlabel_test.py
+++ b/sources/pyside2/tests/QtWidgets/qlabel_test.py
@@ -32,14 +32,7 @@ import unittest
from PySide2.QtGui import QPixmap
from PySide2.QtWidgets import QLabel
-try:
- # The normal import statement when PySide2 is installed.
- from PySide2 import shiboken2 as shiboken
-except ImportError:
- # When running make test in shiboken build dir, or when running
- # testrunner.py, shiboken2 is not part of the PySide2 module,
- # so it needs to be imported as a standalone module.
- import shiboken2 as shiboken
+import shiboken2 as shiboken
from helper import UsesQApplication
diff --git a/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py b/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py
index 7a34cf238..c07bd8705 100644
--- a/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py
+++ b/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py
@@ -31,14 +31,7 @@ import sys
from PySide2.QtGui import QStandardItemModel, QStandardItem
from PySide2.QtWidgets import QWidget
-try:
- # The normal import statement when PySide2 is installed.
- from PySide2 import shiboken2 as shiboken
-except ImportError:
- # When running make test in shiboken build dir, or when running testrunner.py,
- # shiboken2 is not part of the PySide2 module, so it needs to be imported as a standalone
- # module.
- import shiboken2 as shiboken
+import shiboken2 as shiboken
from helper import UsesQApplication
diff --git a/sources/pyside2/tests/registry/existence_test.py b/sources/pyside2/tests/registry/existence_test.py
index 6e870385d..0d8014ad8 100644
--- a/sources/pyside2/tests/registry/existence_test.py
+++ b/sources/pyside2/tests/registry/existence_test.py
@@ -130,7 +130,7 @@ class TestSignaturesExists(unittest.TestCase):
warn(msgMultiSignatureCount(key, found_sigs[key], value))
self.assertTrue(check_warnings())
-tested_versions = (5, 6), (5, 9), (5, 11)
+tested_versions = (5, 6), (5, 9), (5, 11) #, (5, 12) # activate this, soon!
if not have_refmodule and is_ci and qtVersion()[:2] in tested_versions:
class TestFor_CI_Init(unittest.TestCase):
diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py
index 66ec6f566..ded8ba81c 100644
--- a/sources/pyside2/tests/registry/init_platform.py
+++ b/sources/pyside2/tests/registry/init_platform.py
@@ -56,7 +56,6 @@ from textwrap import dedent
all_modules = list("PySide2." + x for x in PySide2.__all__)
from PySide2.QtCore import __version__
-
from PySide2.support.signature.lib.enum_sig import SimplifyingEnumerator
is_py3 = sys.version_info[0] == 3
diff --git a/sources/pyside2/tests/support/voidptr_test.py b/sources/pyside2/tests/support/voidptr_test.py
index 8179407e5..330788c63 100644
--- a/sources/pyside2/tests/support/voidptr_test.py
+++ b/sources/pyside2/tests/support/voidptr_test.py
@@ -27,7 +27,7 @@
#############################################################################
import unittest
-from PySide2 import shiboken2
+import shiboken2 as shiboken
from PySide2.support import VoidPtr
from PySide2.QtCore import QByteArray
@@ -40,7 +40,7 @@ class PySide2Support(unittest.TestCase):
# or another VoidPtr object.
ba = QByteArray(b"Hello world")
voidptr = VoidPtr(ba)
- self.assertIsInstance(voidptr, shiboken2.VoidPtr)
+ self.assertIsInstance(voidptr, shiboken.VoidPtr)
if __name__ == '__main__':
unittest.main()