diff options
author | Christian Tismer <tismer@stackless.com> | 2017-09-21 13:31:24 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2017-09-25 08:15:10 +0000 |
commit | 572a6be53fd39d42288f05ab3c7c9412fc97bc4b (patch) | |
tree | 3fc21b45a6d3e16b4f525811273dbfd5c63a8b7c /sources/pyside2/tests | |
parent | f643be1153275b804e8846b54afccbfef8db43c8 (diff) |
Signature: Improve error reporting
It is likely that with Qt 5.9 we get new signature text that is not recognized.
This becomes a problem because COIN takes much time.
This patch does not stop on the first parser error, but collects
all warnings and raises an error at the end.
Task-number: PYSIDE-510
Change-Id: I898e0a7a59e8313c115d7ce8160908bf85d4140c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r-- | sources/pyside2/tests/pysidetest/signature_test.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sources/pyside2/tests/pysidetest/signature_test.py b/sources/pyside2/tests/pysidetest/signature_test.py index 7fa0ab6fc..583b793eb 100644 --- a/sources/pyside2/tests/pysidetest/signature_test.py +++ b/sources/pyside2/tests/pysidetest/signature_test.py @@ -45,7 +45,6 @@ import unittest from collections import OrderedDict from pprint import pprint import PySide2 -from PySide2 import * """ This test shows that we have over 14500 signatures, @@ -55,7 +54,6 @@ and that they all can be created. all_modules = list("PySide2." + x for x in PySide2.__all__) from PySide2.support.signature import parser, inspect -parser._BREAK_ON_ERROR = True _do_print = True if os.isatty(sys.stdout.fileno()) else False @@ -64,6 +62,7 @@ def dprint(*args, **kw): print(*args, **kw) def enum_module(mod_name): + __import__(mod_name) count = 0 module = sys.modules[mod_name] dprint() @@ -114,7 +113,11 @@ class PySideSignatureTest(unittest.TestCase): result = enum_all() # We omit the number of functions test. This is too vague. for mod_name, count in result.items(): - pass #self.assertGreaterEqual(count, ref_result[mod_name]) + pass + # If an attribute could not be computed, then we will have a warning + # in the warningregistry. + if hasattr(parser, "__warningregistry__"): + raise RuntimeError("There are errors, see above.") def testSignatureExist(self): t1 = type(PySide2.QtCore.QObject.children.__signature__) @@ -144,7 +147,7 @@ class PySideSignatureTest(unittest.TestCase): self.assertTrue(ob1 is ob2) def testModuleIsInitialized(self): - assert QtWidgets.QApplication.__signature__ is not None + assert PySide2.QtWidgets.QApplication.__signature__ is not None if __name__ == "__main__": unittest.main() |