diff options
Diffstat (limited to 'sources/pyside2')
-rw-r--r-- | sources/pyside2/PySide2/__init__.py.in | 3 | ||||
-rw-r--r-- | sources/pyside2/PySide2/support/generate_pyi.py | 12 | ||||
-rw-r--r-- | sources/pyside2/tests/pysidetest/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/pysidetest/embedding_test.py | 74 | ||||
-rw-r--r-- | sources/pyside2/tests/registry/existence_test.py | 8 |
5 files changed, 87 insertions, 11 deletions
diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in index 4548f89b7..d896ab603 100644 --- a/sources/pyside2/PySide2/__init__.py.in +++ b/sources/pyside2/PySide2/__init__.py.in @@ -19,9 +19,6 @@ def _setupQtDirectories(): # loads the libraries into the process memory beforehand, and # thus takes care of it for us. import shiboken2 - # We might be running from CTest and missing shiboken2.__init__, - # so here it is again: Help Python2 by pre-loading modules. - import sys, zipfile, base64, marshal, io # Trigger signature initialization. type.__signature__ diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py index 8474fa732..3b4b3409a 100644 --- a/sources/pyside2/PySide2/support/generate_pyi.py +++ b/sources/pyside2/PySide2/support/generate_pyi.py @@ -107,14 +107,14 @@ class Formatter(Writer): self.mod_name = mod_name self.print("# Module", mod_name) self.print("import PySide2") - self.print("import shiboken2 as Shiboken") - from shibokensupport.signature import typing - self.print("from shibokensupport.signature import typing") - self.print("from shibokensupport.signature.mapping import (") + from PySide2.support.signature import typing + self.print("from PySide2.support.signature import typing") + self.print("from PySide2.support.signature.mapping import (") self.print(" Virtual, Missing, Invalid, Default, Instance)") self.print() self.print("class Object(object): pass") self.print() + self.print("import shiboken2 as Shiboken") self.print("Shiboken.Object = Object") self.print() # This line will be replaced by the missing imports. @@ -289,8 +289,8 @@ def generate_all_pyi(outpath, options): # now we can import global PySide2, inspect, HintingEnumerator import PySide2 - from shibokensupport.signature import inspect - from shibokensupport.signature.lib.enum_sig import HintingEnumerator + from PySide2.support.signature import inspect + from PySide2.support.signature.lib.enum_sig import HintingEnumerator valid = check = 0 if not outpath: diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt index 1b1baf39a..cb8ba04cf 100644 --- a/sources/pyside2/tests/pysidetest/CMakeLists.txt +++ b/sources/pyside2/tests/pysidetest/CMakeLists.txt @@ -140,3 +140,4 @@ PYSIDE_TEST(mixin_signal_slots_test.py) PYSIDE_TEST(signal_slot_warning.py) PYSIDE_TEST(all_modules_load_test.py) PYSIDE_TEST(qapp_like_a_macro_test.py) +PYSIDE_TEST(embedding_test.py) diff --git a/sources/pyside2/tests/pysidetest/embedding_test.py b/sources/pyside2/tests/pysidetest/embedding_test.py new file mode 100644 index 000000000..aa71360ca --- /dev/null +++ b/sources/pyside2/tests/pysidetest/embedding_test.py @@ -0,0 +1,74 @@ +############################################################################# +## +## Copyright (C) 2019 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of PySide2. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +import unittest + +# This test tests the embedding feature of PySide. +# Normally, embedding is only used when necessary. +# By setting the variable "pyside_uses_embedding", +# we enforce usage of embedding. + + +class EmbeddingTest(unittest.TestCase): + + # def test_pyside_normal(self): + # import sys + # self.assertFalse(hasattr(sys, "pyside_uses_embedding")) + # import PySide2 + # # everything has to be imported + # self.assertTrue("PySide2.support.signature" in sys.modules) + # # there should be a variale in sys, now (no idea if set) + # self.assertTrue(hasattr(sys, "pyside_uses_embedding")) + + # Unfortunately, I see no way how to shut things enough down + # to trigger a second initiatization. Therefore, only one test :-/ + def test_pyside_embedding(self): + import sys, os + self.assertFalse(hasattr(sys, "pyside_uses_embedding")) + sys.pyside_uses_embedding = "anything true" + import PySide2 + # everything has to be imported + self.assertTrue("PySide2.support.signature" in sys.modules) + self.assertEqual(sys.pyside_uses_embedding, True) + dn = os.path.dirname + name = os.path.basename(dn(dn(dn(PySide2.support.signature.__file__)))) + self.assertTrue(name.startswith("embedded.") and name.endswith(".zip")) + +if __name__ == '__main__': + unittest.main() diff --git a/sources/pyside2/tests/registry/existence_test.py b/sources/pyside2/tests/registry/existence_test.py index 83f9d79f9..62795f232 100644 --- a/sources/pyside2/tests/registry/existence_test.py +++ b/sources/pyside2/tests/registry/existence_test.py @@ -116,7 +116,9 @@ class TestSignaturesExists(unittest.TestCase): continue if key not in found_sigs: warn("missing key: '{}'".format(key)) - elif isinstance(value, list) and len(value) != len(found_sigs[key]): + elif isinstance(value, list) and len(value) > len(found_sigs[key]): + # We check that nothing got lost. But it is ok when an older + # registry file does not have all variants, yet! warn(msgMultiSignatureCount(key, found_sigs[key], value)) if is_ci and check_warnings(): raise RuntimeError("There are errors, see above.") @@ -132,7 +134,9 @@ class TestSignaturesExists(unittest.TestCase): continue if key not in found_sigs: warn("missing key: '{}'".format(key)) - elif isinstance(value, list) and len(value) != len(found_sigs[key]): + elif isinstance(value, list) and len(value) > len(found_sigs[key]): + # We check that nothing got lost. But it is ok when an older + # registry file does not have all variants, yet! warn(msgMultiSignatureCount(key, found_sigs[key], value)) self.assertTrue(check_warnings()) |