[Python-modules-team] Bug#977078: pykwalify FTBFS with pytest 6
Christian Kastner
ckk at debian.org
Thu Dec 10 19:57:42 GMT 2020
Source: pykwalify
Version: 1.7.0-3
Severity: important
User: pytest at packages.debian.org
Usertags: pytest-v6
Hi,
pykwalify FTBFS with pytest 6 in experimental because it uses a feature
that has been removed:
https://docs.pytest.org/en/stable/deprecations.html#raises-warns-with-a-string-as-the-second-argument
The top of the error log below has more details.
> I: pybuild base:232: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build; python3.9 -m pytest tests
> ============================= test session starts ==============================
> platform linux -- Python 3.9.1, pytest-6.0.2, py-1.9.0, pluggy-0.13.0
> rootdir: /<<PKGBUILDDIR>>, configfile: pytest.ini
> collected 47 items
>
> tests/test_cli.py .. [ 4%]
> tests/test_core.py ...........F. [ 31%]
> tests/test_core_methods.py .... [ 40%]
> tests/test_exceptions.py .. [ 44%]
> tests/test_rule.py ....................... [ 93%]
> tests/test_types.py . [ 95%]
> tests/test_unicode.py .. [100%]
>
> =================================== FAILURES ===================================
> _______________________ TestCore.test_multi_file_support _______________________
>
> self = <tests.test_core.TestCore object at 0x7f0c6575fcd0>
>
> def test_multi_file_support(self):
> """
> This should test that multiple files is supported correctly
> """
> pass_tests = [
> # Test that include directive can be used at top level of the schema
> (
> [
> self.f("partial_schemas", "1s-schema.yaml"),
> self.f("partial_schemas", "1s-partials.yaml"),
> ],
> self.f("partial_schemas", "1s-data.yaml"),
> {
> 'sequence': [{'include': 'fooone'}],
> 'type': 'seq',
> }
> ),
> # # This test that include directive works inside sequence
> # ([self.f("33a.yaml"), self.f("33b.yaml")], self.f("33c.yaml"), {'sequence': [{'include': 'fooone'}], 'type': 'seq'}),
> # This test recursive schemas
> (
> [
> self.f("partial_schemas", "2s-schema.yaml"),
> self.f("partial_schemas", "2s-partials.yaml"),
> ],
> self.f("partial_schemas", "2s-data.yaml"),
> {
> 'sequence': [{'include': 'fooone'}],
> 'type': 'seq',
> }
> ),
> # This tests that you can include a partial schema alongside other rules in a map
> (
> [
> self.f("partial_schemas", "7s-schema.yaml"),
> ],
> self.f("partial_schemas", "7s-data.yaml"),
> {
> 'type': 'map',
> 'mapping': {
> 'foo': {
> 'type': 'str',
> 'required': True
> },
> 'bar': {
> 'include': 'bar'
> }
> }
> }
> )
> ]
>
> failing_tests = [
> # Test include inside partial schema
> (
> [
> self.f("partial_schemas", "1f-schema.yaml"),
> self.f("partial_schemas", "1f-partials.yaml")
> ],
> self.f("partial_schemas", "1f-data.yaml"),
> SchemaError,
> ["Cannot find partial schema with name 'fooonez'. Existing partial schemas: 'bar, fooone, foothree, footwo'. Path: '/0'"]
> ),
> (
> [
> self.f('partial_schemas', '2f-schema.yaml')
> ],
> self.f('partial_schemas', '2f-data.yaml'),
> SchemaError,
> ["Value 'True' is not of type 'str'. Path: '/0'"]
> ),
> (
> [
> self.f('partial_schemas', '3f-schema.yaml')
> ],
> self.f('partial_schemas', '3f-data.yaml'),
> SchemaError,
> ["Value 'True' is not of type 'str'. Path: ''"]
> ),
> (
> [
> self.f('partial_schemas', '4f-schema.yaml')
> ],
> self.f('partial_schemas', '4f-data.yaml'),
> SchemaError,
> ["Value 'True' is not of type 'str'. Path: '/0/foo/0/bar'"]
> ),
> (
> [
> self.f('partial_schemas', '5f-schema.yaml')
> ],
> self.f('partial_schemas', '5f-data.yaml'),
> SchemaError,
> ["Value 'True' is not of type 'str'. Path: '/0/0/0/0'"]
> ),
> (
> [
> self.f('partial_schemas', '6f-schema.yaml')
> ],
> self.f('partial_schemas', '6f-data.yaml'),
> SchemaError,
> ["Value 'True' is not of type 'str'. Path: '/foo/bar/qwe/ewq'"]
> )
> ]
>
> for passing_test in pass_tests:
> try:
> c = Core(source_file=passing_test[1], schema_files=passing_test[0])
> c.validate()
> compare(c.validation_errors, [], prefix="No validation errors should exist...")
> except Exception as e:
> print("ERROR RUNNING FILE: {0} : {1}".format(passing_test[0], passing_test[1]))
> raise e
>
> # This serve as an extra schema validation that tests more complex structures then testrule.py do
> compare(c.root_rule.schema_str, passing_test[2], prefix="Parsed rules is not correct, something have changed...")
>
> for failing_test in failing_tests:
>> with pytest.raises(failing_test[2], message="Test files: {0} : {1}".format(", ".join(failing_test[0]), failing_test[1])):
> E TypeError: Unexpected keyword arguments passed to pytest.raises: message
> E Use context-manager form instead?
>
> tests/test_core.py:339: TypeError
> =============================== warnings summary ===============================
> pykwalify/core.py:7
> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/pykwalify/core.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
> import imp
>
> pykwalify/rule.py:343
> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/pykwalify/rule.py:343: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
> ('nullable', 'nullable')
>
> -- Docs: https://docs.pytest.org/en/stable/warnings.html
> =========================== short test summary info ============================
> FAILED tests/test_core.py::TestCore::test_multi_file_support - TypeError: Une...
> =================== 1 failed, 46 passed, 2 warnings in 0.64s ===================
> E: pybuild pybuild:353: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build; python3.9 -m pytest tests
> dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.9 returned exit code 13
> make: *** [debian/rules:8: build] Error 25
> dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
More information about the Python-modules-team
mailing list