mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.88k stars 586 forks source link

4.2.1: pytest errors `cannot load crypto library for xmlsec.` #1357

Open kloczek opened 1 year ago

kloczek commented 1 year ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

I'm no sure what could be wron in my build env. If may I ask for some hints 🤔 pytest shows as well some PytestUnknownMarkWarning warnings

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.16, pytest-7.2.0, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1, configfile: pyproject.toml, testpaths: tests plugins: anyio-3.6.2, httpx-0.21.0, requests-mock-1.10.0 collected 466 items / 3 errors ========================================================================================== ERRORS =========================================================================================== _______________________________________________________________________ ERROR collecting tests/test_wsse_signature.py _______________________________________________________________________ tests/test_wsse_signature.py:9: in from zeep import ns, wsse ../../BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/zeep/wsse/__init__.py:2: in from .signature import BinarySignature, MemorySignature, Signature ../../BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/zeep/wsse/signature.py:20: in import xmlsec E xmlsec.Error: (1, 'cannot load crypto library for xmlsec.') _______________________________________________________________________ ERROR collecting tests/test_wsse_username.py ________________________________________________________________________ tests/test_wsse_username.py:10: in from zeep.wsse import UsernameToken ../../BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/zeep/wsse/__init__.py:2: in from .signature import BinarySignature, MemorySignature, Signature ../../BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/zeep/wsse/signature.py:20: in import xmlsec E xmlsec.Error: (1, 'cannot load crypto library for xmlsec.') _________________________________________________________________________ ERROR collecting tests/test_wsse_utils.py _________________________________________________________________________ tests/test_wsse_utils.py:3: in from zeep.wsse import utils ../../BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/zeep/wsse/__init__.py:2: in from .signature import BinarySignature, MemorySignature, Signature ../../BUILDROOT/python-zeep-4.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/zeep/wsse/signature.py:20: in import xmlsec E xmlsec.Error: (1, 'cannot load crypto library for xmlsec.') ===================================================================================== warnings summary ====================================================================================== tests/conftest.py:19 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/conftest.py:19: PytestDeprecationWarning: @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same. @pytest.yield_fixture() tests/test_async_client.py:7 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_async_client.py:7: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.asyncio tests/test_async_transport.py:28 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_async_transport.py:28: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.asyncio tests/test_async_transport.py:41 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_async_transport.py:41: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.asyncio tests/test_async_transport.py:58 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_async_transport.py:58: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.asyncio tests/test_async_transport.py:65 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_async_transport.py:65: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.asyncio tests/test_wsdl.py:162 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_wsdl.py:162: DeprecationWarning: invalid escape sequence \- """ tests/test_xsd_union.py:50 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_xsd_union.py:50: DeprecationWarning: invalid escape sequence \d """ -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================================================== short test summary info ================================================================================== ERROR tests/test_wsse_signature.py - xmlsec.Error: (1, 'cannot load crypto library for xmlsec.') ERROR tests/test_wsse_username.py - xmlsec.Error: (1, 'cannot load crypto library for xmlsec.') ERROR tests/test_wsse_utils.py - xmlsec.Error: (1, 'cannot load crypto library for xmlsec.') !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! =============================================================================== 8 warnings, 3 errors in 1.01s =============================================================================== ```

Here is list of installed modules in build env

```console Package Version ----------------------------- ----------------- aiohttp 3.8.3 aioresponses 0.7.4 aiosignal 1.3.1 alabaster 0.7.12 anyio 3.6.2 async-timeout 4.0.2 attrs 22.2.0 Babel 2.11.0 build 0.9.0 cached-property 1.5.2 certifi 2022.9.24 charset-normalizer 3.0.1 distro 1.8.0 docutils 0.19 exceptiongroup 1.0.0 extras 1.0.0 fixtures 4.0.0 freezegun 1.2.1 frozenlist 1.3.3 gpg 1.18.0-unknown h11 0.13.0 httpcore 0.16.3 httpx 0.23.3 idna 3.4 imagesize 1.4.1 importlib-metadata 5.1.0 iniconfig 1.1.1 isodate 0.6.1 Jinja2 3.1.2 libcomps 0.1.19 lxml 4.9.1 MarkupSafe 2.1.1 multidict 6.0.2 packaging 21.3 pbr 5.9.0 pep517 0.13.0 pip 22.3.1 platformdirs 2.6.0 pluggy 1.0.0 pretend 1.0.9 Pygments 2.14.0 PyGObject 3.42.2 pyparsing 3.0.9 pytest 7.2.0 pytest-httpx 0.21.0 python-dateutil 2.8.2 pytz 2022.4 requests 2.28.1 requests-file 1.5.1 requests-mock 1.10.0 requests-toolbelt 0.10.1 rpm 4.17.0 setuptools 65.6.3 six 1.16.0 sniffio 1.2.0 snowballstemmer 2.2.0 Sphinx 5.3.0 sphinxcontrib-applehelp 1.0.2.dev20221204 sphinxcontrib-devhelp 1.0.2.dev20221204 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1.dev20221204 sphinxcontrib-qthelp 1.0.3.dev20221204 sphinxcontrib-serializinghtml 1.1.5 testtools 2.5.0 tomli 2.0.1 urllib3 1.26.12 wheel 0.38.4 xmlsec 1.3.13 yarl 1.8.2 zipp 3.11.0 ```
kloczek commented 1 year ago

gentle ping .. 🤔

kloczek commented 4 months ago

With new pytest 8.2.1 test suite fails in new unit

Here is pytest output: ```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-zeep-4.2.1-6.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-zeep-4.2.1-6.fc37.x86_64/usr/lib/python3.10/site-packages + /usr/bin/pytest -ra -m 'not network' --deselect tests/test_transports.py::test_load_file_unix --ignore tests/test_wsse_signature.py --ignore tests/test_wsse_username.py --ignore tests/test_wsse_utils.py ============================= test session starts ============================== platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0 rootdir: /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1 configfile: pyproject.toml testpaths: tests plugins: anyio-4.3.0, requests-mock-1.12.1, httpx-0.30.0, asyncio-0.23.7 asyncio: mode=strict collected 466 items / 1 deselected / 465 selected tests/integration/test_hello_world_recursive.py . [ 0%] tests/integration/test_http_post.py .. [ 0%] tests/integration/test_recursive_schema.py . [ 0%] tests/test_async_client.py . [ 1%] tests/test_async_transport.py ...... [ 2%] tests/test_cache.py ............ [ 4%] tests/test_client.py .................s.... [ 9%] tests/test_client_factory.py ..... [ 10%] tests/test_helpers.py ..... [ 11%] tests/test_loader.py .. [ 12%] tests/test_main.py .. [ 12%] tests/test_pprint.py .. [ 13%] tests/test_response.py . [ 13%] tests/test_settings.py .. [ 13%] tests/test_soap_multiref.py .. [ 14%] tests/test_soap_xop.py ... [ 14%] tests/test_transports.py ...ss. [ 16%] tests/test_wsa.py ..... [ 17%] tests/test_wsdl.py .................... [ 21%] tests/test_wsdl_arrays.py ......... [ 23%] tests/test_wsdl_messages_document.py ................... [ 27%] tests/test_wsdl_messages_http.py ....... [ 29%] tests/test_wsdl_messages_rpc.py ....... [ 30%] tests/test_wsdl_no_output_message_part.py . [ 30%] tests/test_wsdl_soap.py ............ [ 33%] tests/test_xsd.py ................. [ 36%] tests/test_xsd_any.py .............. [ 40%] tests/test_xsd_attributes.py ............ [ 42%] tests/test_xsd_builtins.py ................F............................ [ 52%] [ 52%] tests/test_xsd_complex_types.py ......... [ 54%] tests/test_xsd_element.py . [ 54%] tests/test_xsd_extension.py .............. [ 57%] tests/test_xsd_indicators_all.py .. [ 57%] tests/test_xsd_indicators_choice.py ............................... [ 64%] tests/test_xsd_indicators_group.py ............ [ 67%] tests/test_xsd_indicators_sequence.py ............. [ 69%] tests/test_xsd_integration.py ........................ [ 75%] tests/test_xsd_parse.py ............ [ 77%] tests/test_xsd_schemas.py ............................ [ 83%] tests/test_xsd_signatures.py ........ [ 85%] tests/test_xsd_simple_types.py ...... [ 86%] tests/test_xsd_types.py ............... [ 89%] tests/test_xsd_union.py .. [ 90%] tests/test_xsd_validation.py .. [ 90%] tests/test_xsd_valueobjects.py ..................... [ 95%] tests/test_xsd_visitor.py ...................... [100%] =================================== FAILURES =================================== __________________________ TestDateTime.test_xmlvalue __________________________ self = def test_xmlvalue(self): instance = builtins.DateTime() value = datetime.datetime(2016, 3, 4, 21, 14, 42) assert instance.xmlvalue(value) == "2016-03-04T21:14:42" value = datetime.datetime(2016, 3, 4, 21, 14, 42, tzinfo=pytz.utc) assert instance.xmlvalue(value) == "2016-03-04T21:14:42Z" value = datetime.datetime(2016, 3, 4, 21, 14, 42, 123456, tzinfo=pytz.utc) assert instance.xmlvalue(value) == "2016-03-04T21:14:42.123456Z" value = datetime.datetime(2016, 3, 4, 21, 14, 42, tzinfo=pytz.utc) value = value.astimezone(pytz.timezone("Europe/Amsterdam")) > assert instance.xmlvalue(value) == "2016-03-04T22:14:42+01:00" E AssertionError: assert '2016-03-04T21:14:42Z' == '2016-03-04T22:14:42+01:00' E E - 2016-03-04T22:14:42+01:00 E ? ^ ^^^^^^ E + 2016-03-04T21:14:42Z E ? ^ ^ tests/test_xsd_builtins.py:172: AssertionError =============================== warnings summary =============================== tests/conftest.py:19 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/conftest.py:19: PytestDeprecationWarning: @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same. @pytest.yield_fixture() tests/test_wsdl.py:162 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_wsdl.py:162: DeprecationWarning: invalid escape sequence '\-' """ tests/test_xsd_union.py:50 /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/test_xsd_union.py:50: DeprecationWarning: invalid escape sequence '\d' """ tests/test_async_client.py::test_context_manager tests/test_async_transport.py::test_no_cache tests/test_async_transport.py::test_load_cache tests/test_async_transport.py::test_post tests/test_async_transport.py::test_session_close tests/test_async_transport.py::test_http_error /usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:746: DeprecationWarning: The event_loop fixture provided by pytest-asyncio has been redefined in /home/tkloczko/rpmbuild/BUILD/python-zeep-4.2.1/tests/conftest.py:19 Replacing the event_loop fixture with a custom implementation is deprecated and will lead to errors in the future. If you want to request an asyncio event loop with a scope other than function scope, use the "scope" argument to the asyncio mark when marking the tests. If you want to return different types of event loops, use the event_loop_policy fixture. warnings.warn( tests/test_async_transport.py::test_load_cache tests/test_async_transport.py:27: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'. @pytest.mark.requests -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ SKIPPED [1] tests/test_client.py:168: test valid for windows platform only SKIPPED [1] tests/test_transports.py:34: test valid for windows platform only SKIPPED [1] tests/test_transports.py:54: test valid for windows platform only FAILED tests/test_xsd_builtins.py::TestDateTime::test_xmlvalue - AssertionErr... ===== 1 failed, 461 passed, 3 skipped, 1 deselected, 10 warnings in 2.49s ====== ```