aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside2/PySide2/support/signature/parser.py7
-rw-r--r--sources/pyside2/tests/pysidetest/signature_test.py11
2 files changed, 8 insertions, 10 deletions
diff --git a/sources/pyside2/PySide2/support/signature/parser.py b/sources/pyside2/PySide2/support/signature/parser.py
index c944fe856..0224095b5 100644
--- a/sources/pyside2/PySide2/support/signature/parser.py
+++ b/sources/pyside2/PySide2/support/signature/parser.py
@@ -48,7 +48,6 @@ import functools
from .mapping import type_map, update_mapping, __dict__ as namespace
_DEBUG = False
-_BREAK_ON_ERROR = False
TYPE_MAP_DOC = """
The type_map variable is central for the signature package.
@@ -165,11 +164,7 @@ def _resolve_value(thing, valtype, line):
UNRECOGNIZED: {!r}
OFFENDING LINE: {!r}
-
- """.format(thing, line),
- RuntimeWarning)
- if _BREAK_ON_ERROR:
- raise RuntimeError
+ """.format(thing, line), RuntimeWarning)
return thing
def _resolve_type(thing, line):
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()