yams #10132388 Several tests fail under Python 3.7 [open]
Several tests currently fail under Pyton 3.7 when they pass using Python 2. See attached test log: ============================= test session starts ============================== platform linux -- Python 3.7.3rc1, pytest-3.10.1, py-1.7.0, pluggy-0.8.0 rootdir: /tmp/autopkgtest.RRoXpd/autopkgtest_tmp, inifile: tox.ini collected 141 items test/unittest_constraints.py ..............FF. [ 12%] test/unittest_diff.py ........ [ 17%] test/unittest_reader.py ................................................ [ 51%] ............ [ 60%] test/unittest_schema.py .............................................. [ 92%] test/unittest_schema2dot.py . [ 93%] test/unittest_serialize.py . [ 94%] test/unittest_specialization.py ....... [ 99%] test/unittest_xy.py . [100%] =================================== FAILURES =================================== ___________________ ConstraintTC.test_regexp_deserialization ___________________ cls = <class 'yams.constraints.RegexpConstraint'>, value = '[a-z]+,[A-Z]+,12' @classmethod def deserialize(cls, value): """simple text deserialization""" try: > d = cstr_json_loads(value) /usr/lib/python3/dist-packages/yams/constraints.py:300: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <json.decoder.JSONDecoder object at 0x7ff2184dbeb8> s = '[a-z]+,[A-Z]+,12' _w = <built-in method match of re.Pattern object at 0x7ff218bd7ab0> def decode(self, s, _w=WHITESPACE.match): """Return the Python representation of ``s`` (a ``str`` instance containing a JSON document). """ > obj, end = self.raw_decode(s, idx=_w(s, 0).end()) /usr/lib/python3.7/json/decoder.py:337: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <json.decoder.JSONDecoder object at 0x7ff2184dbeb8> s = '[a-z]+,[A-Z]+,12', idx = 0 def raw_decode(self, s, idx=0): """Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. """ try: obj, end = self.scan_once(s, idx) except StopIteration as err: > raise JSONDecodeError("Expecting value", s, err.value) from None E json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1) /usr/lib/python3.7/json/decoder.py:355: JSONDecodeError During handling of the above exception, another exception occurred: self = <unittest_constraints.ConstraintTC testMethod=test_regexp_deserialization> def test_regexp_deserialization(self): > cstr = RegexpConstraint.deserialize('[a-z]+,[A-Z]+,12') test/unittest_constraints.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/yams/constraints.py:304: in deserialize return cls(regexp, int(flags)) /usr/lib/python3/dist-packages/yams/constraints.py:269: in __init__ self._rgx = re.compile(regexp, flags) /usr/lib/python3.7/re.py:234: in compile return _compile(pattern, flags) /usr/lib/python3.7/re.py:286: in _compile p = sre_compile.compile(pattern, flags) /usr/lib/python3.7/sre_compile.py:764: in compile p = sre_parse.parse(p, flags) /usr/lib/python3.7/sre_parse.py:940: in parse p.pattern.flags = fix_flags(str, p.pattern.flags) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src = '[a-z]+,[A-Z]+', flags = 12 def fix_flags(src, flags): # Check and fix flags according to the type of pattern (str or bytes) if isinstance(src, str): if flags & SRE_FLAG_LOCALE: > raise ValueError("cannot use LOCALE flag with a str pattern") E ValueError: cannot use LOCALE flag with a str pattern /usr/lib/python3.7/sre_parse.py:907: ValueError ____________________ ConstraintTC.test_regexp_serialization ____________________ self = <unittest_constraints.ConstraintTC testMethod=test_regexp_serialization> def test_regexp_serialization(self): > cstr = RegexpConstraint('[a-z]+,[A-Z]+', 12) test/unittest_constraints.py:104: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/yams/constraints.py:269: in __init__ self._rgx = re.compile(regexp, flags) /usr/lib/python3.7/re.py:234: in compile return _compile(pattern, flags) /usr/lib/python3.7/re.py:286: in _compile p = sre_compile.compile(pattern, flags) /usr/lib/python3.7/sre_compile.py:764: in compile p = sre_parse.parse(p, flags) /usr/lib/python3.7/sre_parse.py:940: in parse p.pattern.flags = fix_flags(str, p.pattern.flags) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src = '[a-z]+,[A-Z]+', flags = 12 def fix_flags(src, flags): # Check and fix flags according to the type of pattern (str or bytes) if isinstance(src, str): if flags & SRE_FLAG_LOCALE: > raise ValueError("cannot use LOCALE flag with a str pattern") E ValueError: cannot use LOCALE flag with a str pattern /usr/lib/python3.7/sre_parse.py:907: ValueError =============================== warnings summary =============================== /usr/lib/python3/dist-packages/yams/reader.py:124 /usr/lib/python3/dist-packages/yams/reader.py:124: DeprecationWarning: provide a list of modules names instead of directories DeprecationWarning) /usr/lib/python3/dist-packages/yams/reader.py:235 /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) test/unittest_reader.py::SchemaLoaderTC::test_attributes_permissions /usr/lib/python3/dist-packages/yams/reader.py:124: DeprecationWarning: provide a list of modules names instead of directories DeprecationWarning) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) test/unittest_reader.py::PySchemaTC::test_date_defaults /usr/lib/python3/dist-packages/yams/reader.py:124: DeprecationWarning: provide a list of modules names instead of directories DeprecationWarning) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) test/unittest_reader.py::SchemaLoaderTC2::test_imports /usr/lib/python3/dist-packages/yams/reader.py:124: DeprecationWarning: provide a list of modules names instead of directories DeprecationWarning) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) test/unittest_reader.py::SchemaLoaderTC2::test_post_build_callback /usr/lib/python3/dist-packages/yams/reader.py:124: DeprecationWarning: provide a list of modules names instead of directories DeprecationWarning) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) test/unittest_schema.py::EntitySchemaTC::test_attribute_description /usr/lib/python3/dist-packages/yams/reader.py:124: DeprecationWarning: provide a list of modules names instead of directories DeprecationWarning) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) test/unittest_schema.py::EntitySchemaTC::test_deepcopy_specialization /usr/lib/python3/dist-packages/yams/reader.py:124: DeprecationWarning: provide a list of modules names instead of directories DeprecationWarning) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) /usr/lib/python3/dist-packages/yams/reader.py:235: DeprecationWarning: you should avoid using modpath_from_file() modname = '.'.join(modpath_from_file(filepath, self.extrapath)) -- Docs: https://docs.pytest.org/en/latest/warnings.html ============== 2 failed, 139 passed, 39 warnings in 0.85 seconds =============== | |
priority | normal |
---|---|
type | bug |
done in | <not specified> |
closed by | <not specified> |
Comments
-
2019/06/03 20:14, written by nchauvat
add commentI suggest to change line yams/test/unittest_constraints.py:109 from '[a-z]+,[A-Z]+,12' to '[a-z]+,[A-Z]+,8' because 12 equals re.LOCALE (4)+re.MULTILINE (8) but re.LOCALE can only be used with bytes and we have to decode a str. Removing that useless flag should be enough to fix the test.
Lines 104 105 and 111 are to be changed too with 12 => 8.