Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.0: issue with testing🤔 #150

Open
kloczek opened this issue Feb 13, 2023 · 6 comments
Open

0.7.0: issue with testing🤔 #150

kloczek opened this issue Feb 13, 2023 · 6 comments

Comments

@kloczek
Copy link

kloczek commented Feb 13, 2023

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.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pkcs11-0.7.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pkcs11-0.7.0-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.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0
collected 0 items / 13 errors

==================================== ERRORS ====================================
______________________ ERROR collecting tests/test_aes.py ______________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
______________________ ERROR collecting tests/test_des.py ______________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
______________________ ERROR collecting tests/test_dh.py _______________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
____________________ ERROR collecting tests/test_digest.py _____________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
______________________ ERROR collecting tests/test_dsa.py ______________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
______________________ ERROR collecting tests/test_ecc.py ______________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
___________________ ERROR collecting tests/test_iterators.py ___________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
______________ ERROR collecting tests/test_public_key_external.py ______________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
______________________ ERROR collecting tests/test_rsa.py ______________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
___________________ ERROR collecting tests/test_sessions.py ____________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
_______________ ERROR collecting tests/test_slots_and_tokens.py ________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
___________________ ERROR collecting tests/test_threading.py ___________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
_____________________ ERROR collecting tests/test_x509.py ______________________
tests/__init__.py:23: in <module>
    LIB = os.environ['PKCS11_MODULE']
/usr/lib64/python3.8/os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'PKCS11_MODULE'

During handling of the above exception, another exception occurred:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
tests/__init__.py:25: in <module>
    raise RuntimeError("Must define `PKCS11_MODULE' to run tests.")
E   RuntimeError: Must define `PKCS11_MODULE' to run tests.
=========================== short test summary info ============================
ERROR tests/test_aes.py - RuntimeError: Must define `PKCS11_MODULE' to run te...
ERROR tests/test_des.py - RuntimeError: Must define `PKCS11_MODULE' to run te...
ERROR tests/test_dh.py - RuntimeError: Must define `PKCS11_MODULE' to run tests.
ERROR tests/test_digest.py - RuntimeError: Must define `PKCS11_MODULE' to run...
ERROR tests/test_dsa.py - RuntimeError: Must define `PKCS11_MODULE' to run te...
ERROR tests/test_ecc.py - RuntimeError: Must define `PKCS11_MODULE' to run te...
ERROR tests/test_iterators.py - RuntimeError: Must define `PKCS11_MODULE' to ...
ERROR tests/test_public_key_external.py - RuntimeError: Must define `PKCS11_M...
ERROR tests/test_rsa.py - RuntimeError: Must define `PKCS11_MODULE' to run te...
ERROR tests/test_sessions.py - RuntimeError: Must define `PKCS11_MODULE' to r...
ERROR tests/test_slots_and_tokens.py - RuntimeError: Must define `PKCS11_MODU...
ERROR tests/test_threading.py - RuntimeError: Must define `PKCS11_MODULE' to ...
ERROR tests/test_x509.py - RuntimeError: Must define `PKCS11_MODULE' to run t...
!!!!!!!!!!!!!!!!!!! Interrupted: 13 errors during collection !!!!!!!!!!!!!!!!!!!
============================== 13 errors in 0.41s ==============================

Q: what needs to be passed in $PKCS11_MODULE? 🤔

@HRio
Copy link
Contributor

HRio commented Feb 13, 2023

PKCS11_MODULE should point to the .so file needed to access the HSM e.g. /usr/lib/softhsm/libsofthsm2.so

For reference you can find how check() is done on Alpine here:
https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/py3-pkcs11/APKBUILD#L41

@paravoid
Copy link

paravoid commented Feb 28, 2023

PKCS11_MODULE should point to the .so file needed to access the HSM e.g. /usr/lib/softhsm/libsofthsm2.so

For reference you can find how check() is done on Alpine here: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/py3-pkcs11/APKBUILD#L41

Off-topic to this current issue, but... I started packaging this module for Debian, and basically started rediscovering and patching the same issues you did, until I saw your comment here! Thank you for your work! I noticed PRs for a few of these (#142, #143) but not all.

@danni Given that now we have some of these are basically just failures with a newer libraries, tools etc., perhaps you could issue a 0.7.1 fixing all these issues?

@kloczek
Copy link
Author

kloczek commented Feb 28, 2023

OK .. after add al necessary variables, add softhsm and asn1crypto modile to build env I was able to start pytest.
Just after that I've hit the issu that pytest units where not able to find _pkcs11 module.

+ cd python-pkcs11-0.7.0
+ export PKCS11_MODULE=/usr/lib64/softhsm/libsofthsm2.so PKCS11_TOKEN_LABEL=pytest PKCS11_TOKEN_PIN=1234 PKCS11_TOKEN_SO_PIN=987654321
+ PKCS11_MODULE=/usr/lib64/softhsm/libsofthsm2.so
+ PKCS11_TOKEN_LABEL=pytest
+ PKCS11_TOKEN_PIN=1234
+ PKCS11_TOKEN_SO_PIN=987654321
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pkcs11-0.7.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pkcs11-0.7.0-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.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0
collected 70 items

tests/test_aes.py EEEEEEE                                                [ 10%]
tests/test_des.py EEEE                                                   [ 15%]
tests/test_dh.py EEE                                                     [ 20%]
tests/test_digest.py EEEE                                                [ 25%]
tests/test_dsa.py EEE                                                    [ 30%]
tests/test_ecc.py EEEEEE                                                 [ 38%]
tests/test_iterators.py EE                                               [ 41%]
tests/test_public_key_external.py EEEE                                   [ 47%]
tests/test_rsa.py EEEEEEE                                                [ 57%]
tests/test_sessions.py EEEEEEEEEEEEEE                                    [ 77%]
tests/test_slots_and_tokens.py FFFFFFFF                                  [ 88%]
tests/test_threading.py E                                                [ 90%]
tests/test_x509.py EEEEEEE                                               [100%]

==================================== ERRORS ====================================
___________________ ERROR at setup of AESTests.test_encrypt ____________________

cls = <class 'tests.test_aes.AESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of AESTests.test_encrypt_big_string ______________

cls = <class 'tests.test_aes.AESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
________________ ERROR at setup of AESTests.test_encrypt_stream ________________

cls = <class 'tests.test_aes.AESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________ ERROR at setup of AESTests.test_encrypt_whacky_sizes _____________

cls = <class 'tests.test_aes.AESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________________ ERROR at setup of AESTests.test_sign _____________________

cls = <class 'tests.test_aes.AESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ ERROR at setup of AESTests.test_sign_stream __________________

cls = <class 'tests.test_aes.AESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________________ ERROR at setup of AESTests.test_wrap _____________________

cls = <class 'tests.test_aes.AESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ ERROR at setup of DESTests.test_encrypt_des2 _________________

cls = <class 'tests.test_des.DESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ ERROR at setup of DESTests.test_encrypt_des3 _________________

cls = <class 'tests.test_des.DESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of DESTests.test_generate_des2_key _______________

cls = <class 'tests.test_des.DESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of DESTests.test_generate_des3_key _______________

cls = <class 'tests.test_des.DESTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________________ ERROR at setup of DHTests.test_derive_key ___________________

cls = <class 'tests.test_dh.DHTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
________________ ERROR at setup of DHTests.test_generate_params ________________

cls = <class 'tests.test_dh.DHTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________________ ERROR at setup of DHTests.test_load_params __________________

cls = <class 'tests.test_dh.DHTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________________ ERROR at setup of DigestTests.test_digest ___________________

cls = <class 'tests.test_digest.DigestTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________ ERROR at setup of DigestTests.test_digest_generator ______________

cls = <class 'tests.test_digest.DigestTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
________________ ERROR at setup of DigestTests.test_digest_key _________________

cls = <class 'tests.test_digest.DigestTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of DigestTests.test_digest_key_data ______________

cls = <class 'tests.test_digest.DigestTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________ ERROR at setup of DSATests.test_generate_keypair_and_sign ___________

cls = <class 'tests.test_dsa.DSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________ ERROR at setup of DSATests.test_generate_keypair_directly ___________

cls = <class 'tests.test_dsa.DSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______________ ERROR at setup of DSATests.test_generate_params ________________

cls = <class 'tests.test_dsa.DSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________________ ERROR at setup of ECCTests.test_derive_key __________________

cls = <class 'tests.test_ecc.ECCTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
____________ ERROR at setup of ECCTests.test_import_key_named_curve ____________

cls = <class 'tests.test_ecc.ECCTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______________ ERROR at setup of ECCTests.test_import_key_pair ________________

cls = <class 'tests.test_ecc.ECCTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of ECCTests.test_import_key_params _______________

cls = <class 'tests.test_ecc.ECCTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________________ ERROR at setup of ECCTests.test_sign_ecdsa __________________

cls = <class 'tests.test_ecc.ECCTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________________ ERROR at setup of ECCTests.test_sign_eddsa __________________

cls = <class 'tests.test_ecc.ECCTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________ ERROR at setup of IteratorTests.test_close_iterators _____________

cls = <class 'tests.test_iterators.IteratorTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________ ERROR at setup of IteratorTests.test_partial_decrypt _____________

cls = <class 'tests.test_iterators.IteratorTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of ExternalPublicKeyTests.test_ecdh ______________

cls = <class 'tests.test_public_key_external.ExternalPublicKeyTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________ ERROR at setup of ExternalPublicKeyTests.test_ecdsa ______________

cls = <class 'tests.test_public_key_external.ExternalPublicKeyTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of ExternalPublicKeyTests.test_rsa _______________

cls = <class 'tests.test_public_key_external.ExternalPublicKeyTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_ ERROR at setup of ExternalPublicKeyTests.test_terrible_hybrid_file_encryption_app _

cls = <class 'tests.test_public_key_external.ExternalPublicKeyTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ ERROR at setup of RSATests.test_encrypt_oaep _________________

cls = <class 'tests.test_rsa.RSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
____________ ERROR at setup of RSATests.test_encrypt_too_much_data _____________

cls = <class 'tests.test_rsa.RSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
___________________ ERROR at setup of RSATests.test_key_wrap ___________________

cls = <class 'tests.test_rsa.RSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ ERROR at setup of RSATests.test_sign_default _________________

cls = <class 'tests.test_rsa.RSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
________________ ERROR at setup of RSATests.test_sign_pkcs_v15 _________________

cls = <class 'tests.test_rsa.RSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
___________________ ERROR at setup of RSATests.test_sign_pss ___________________

cls = <class 'tests.test_rsa.RSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ ERROR at setup of RSATests.test_sign_stream __________________

cls = <class 'tests.test_rsa.RSATests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______________ ERROR at setup of SessionTests.test_copy_object ________________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of SessionTests.test_create_object _______________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of SessionTests.test_destroy_object ______________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______________ ERROR at setup of SessionTests.test_generate_key _______________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________ ERROR at setup of SessionTests.test_generate_keypair _____________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________ ERROR at setup of SessionTests.test_generate_random ______________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ ERROR at setup of SessionTests.test_get_key __________________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
____________ ERROR at setup of SessionTests.test_get_key_not_found _____________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of SessionTests.test_get_key_vague _______________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______________ ERROR at setup of SessionTests.test_get_objects ________________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______________ ERROR at setup of SessionTests.test_open_session _______________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
________ ERROR at setup of SessionTests.test_open_session_and_login_so _________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______ ERROR at setup of SessionTests.test_open_session_and_login_user ________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_______________ ERROR at setup of SessionTests.test_seed_random ________________

cls = <class 'tests.test_sessions.SessionTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________ ERROR at setup of ThreadingTests.test_concurrency _______________

cls = <class 'tests.test_threading.ThreadingTests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
____________ ERROR at setup of X509Tests.test_import_ca_certificate ____________

cls = <class 'tests.test_x509.X509Tests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________ ERROR at setup of X509Tests.test_import_ca_certificate_easy __________

cls = <class 'tests.test_x509.X509Tests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
____________ ERROR at setup of X509Tests.test_self_sign_certificate ____________

cls = <class 'tests.test_x509.X509Tests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________________ ERROR at setup of X509Tests.test_sign_csr ___________________

cls = <class 'tests.test_x509.X509Tests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
___________ ERROR at setup of X509Tests.test_verify_certificate_dsa ____________

cls = <class 'tests.test_x509.X509Tests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________ ERROR at setup of X509Tests.test_verify_certificate_ecdsa ___________

cls = <class 'tests.test_x509.X509Tests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
___________ ERROR at setup of X509Tests.test_verify_certificate_rsa ____________

cls = <class 'tests.test_x509.X509Tests'>

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
>       cls.lib = lib = pkcs11.lib(LIB)

tests/__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
=================================== FAILURES ===================================
__________________ SlotsAndTokensTests.test_double_initialise __________________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_double_initialise>

    def test_double_initialise(self):
>       self.assertIsNotNone(pkcs11.lib(LIB))

tests/test_slots_and_tokens.py:15:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
__________ SlotsAndTokensTests.test_double_initialise_different_libs ___________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_double_initialise_different_libs>

    def test_double_initialise_different_libs(self):
>       self.assertIsNotNone(pkcs11.lib(LIB))

tests/test_slots_and_tokens.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_________________ SlotsAndTokensTests.test_get_mechanism_info __________________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_get_mechanism_info>

    def test_get_mechanism_info(self):
>       lib = pkcs11.lib(LIB)

tests/test_slots_and_tokens.py:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
________________ SlotsAndTokensTests.test_get_mechanism_info_ec ________________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_get_mechanism_info_ec>

    @Not.nfast  # EC not supported
    @Not.opencryptoki
    def test_get_mechanism_info_ec(self):
>       lib = pkcs11.lib(LIB)

tests/test_slots_and_tokens.py:49:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
___________________ SlotsAndTokensTests.test_get_mechanisms ____________________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_get_mechanisms>

    def test_get_mechanisms(self):
>       lib = pkcs11.lib(LIB)

tests/test_slots_and_tokens.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________________ SlotsAndTokensTests.test_get_slots ______________________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_get_slots>

    @Only.softhsm2
    def test_get_slots(self):
>       lib = pkcs11.lib(LIB)

tests/test_slots_and_tokens.py:25:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
______________________ SlotsAndTokensTests.test_get_token ______________________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_get_token>

    @Only.softhsm2
    def test_get_token(self):
>       lib = pkcs11.lib(LIB)

tests/test_slots_and_tokens.py:67:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
_____________________ SlotsAndTokensTests.test_get_tokens ______________________

self = <tests.test_slots_and_tokens.SlotsAndTokensTests testMethod=test_get_tokens>

    @Only.softhsm2
    def test_get_tokens(self):
>       lib = pkcs11.lib(LIB)

tests/test_slots_and_tokens.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

so = '/usr/lib64/softhsm/libsofthsm2.so'

    def lib(so):
        """
        Wrap the main library call coming from Cython with a preemptive
        dynamic loading.
        """
        global _lib
        global _so

        if _lib:
            if _so != so:
                raise AlreadyInitialized(  # noqa: F405
                    "Already initialized with %s" % so)
            else:
                return _lib

>       from . import _pkcs11
E       ImportError: cannot import name '_pkcs11' from 'pkcs11' (/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/pkcs11/__init__.py)

pkcs11/__init__.py:30: ImportError
=============================== warnings summary ===============================
tests/__init__.py:44
  /home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/__init__.py:44: UserWarning: Path to OpenSSL not found. Please adjust `PATH' or define `OPENSSL_PATH'
    warn("Path to OpenSSL not found. Please adjust `PATH' or define `OPENSSL_PATH'")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/test_aes.py::AESTests::test_encrypt - ImportError: cannot import ...
ERROR tests/test_aes.py::AESTests::test_encrypt_big_string - ImportError: can...
ERROR tests/test_aes.py::AESTests::test_encrypt_stream - ImportError: cannot ...
ERROR tests/test_aes.py::AESTests::test_encrypt_whacky_sizes - ImportError: c...
ERROR tests/test_aes.py::AESTests::test_sign - ImportError: cannot import nam...
ERROR tests/test_aes.py::AESTests::test_sign_stream - ImportError: cannot imp...
ERROR tests/test_aes.py::AESTests::test_wrap - ImportError: cannot import nam...
ERROR tests/test_des.py::DESTests::test_encrypt_des2 - ImportError: cannot im...
ERROR tests/test_des.py::DESTests::test_encrypt_des3 - ImportError: cannot im...
ERROR tests/test_des.py::DESTests::test_generate_des2_key - ImportError: cann...
ERROR tests/test_des.py::DESTests::test_generate_des3_key - ImportError: cann...
ERROR tests/test_dh.py::DHTests::test_derive_key - ImportError: cannot import...
ERROR tests/test_dh.py::DHTests::test_generate_params - ImportError: cannot i...
ERROR tests/test_dh.py::DHTests::test_load_params - ImportError: cannot impor...
ERROR tests/test_digest.py::DigestTests::test_digest - ImportError: cannot im...
ERROR tests/test_digest.py::DigestTests::test_digest_generator - ImportError:...
ERROR tests/test_digest.py::DigestTests::test_digest_key - ImportError: canno...
ERROR tests/test_digest.py::DigestTests::test_digest_key_data - ImportError: ...
ERROR tests/test_dsa.py::DSATests::test_generate_keypair_and_sign - ImportErr...
ERROR tests/test_dsa.py::DSATests::test_generate_keypair_directly - ImportErr...
ERROR tests/test_dsa.py::DSATests::test_generate_params - ImportError: cannot...
ERROR tests/test_ecc.py::ECCTests::test_derive_key - ImportError: cannot impo...
ERROR tests/test_ecc.py::ECCTests::test_import_key_named_curve - ImportError:...
ERROR tests/test_ecc.py::ECCTests::test_import_key_pair - ImportError: cannot...
ERROR tests/test_ecc.py::ECCTests::test_import_key_params - ImportError: cann...
ERROR tests/test_ecc.py::ECCTests::test_sign_ecdsa - ImportError: cannot impo...
ERROR tests/test_ecc.py::ECCTests::test_sign_eddsa - ImportError: cannot impo...
ERROR tests/test_iterators.py::IteratorTests::test_close_iterators - ImportEr...
ERROR tests/test_iterators.py::IteratorTests::test_partial_decrypt - ImportEr...
ERROR tests/test_public_key_external.py::ExternalPublicKeyTests::test_ecdh - ...
ERROR tests/test_public_key_external.py::ExternalPublicKeyTests::test_ecdsa
ERROR tests/test_public_key_external.py::ExternalPublicKeyTests::test_rsa - I...
ERROR tests/test_public_key_external.py::ExternalPublicKeyTests::test_terrible_hybrid_file_encryption_app
ERROR tests/test_rsa.py::RSATests::test_encrypt_oaep - ImportError: cannot im...
ERROR tests/test_rsa.py::RSATests::test_encrypt_too_much_data - ImportError: ...
ERROR tests/test_rsa.py::RSATests::test_key_wrap - ImportError: cannot import...
ERROR tests/test_rsa.py::RSATests::test_sign_default - ImportError: cannot im...
ERROR tests/test_rsa.py::RSATests::test_sign_pkcs_v15 - ImportError: cannot i...
ERROR tests/test_rsa.py::RSATests::test_sign_pss - ImportError: cannot import...
ERROR tests/test_rsa.py::RSATests::test_sign_stream - ImportError: cannot imp...
ERROR tests/test_sessions.py::SessionTests::test_copy_object - ImportError: c...
ERROR tests/test_sessions.py::SessionTests::test_create_object - ImportError:...
ERROR tests/test_sessions.py::SessionTests::test_destroy_object - ImportError...
ERROR tests/test_sessions.py::SessionTests::test_generate_key - ImportError: ...
ERROR tests/test_sessions.py::SessionTests::test_generate_keypair - ImportErr...
ERROR tests/test_sessions.py::SessionTests::test_generate_random - ImportErro...
ERROR tests/test_sessions.py::SessionTests::test_get_key - ImportError: canno...
ERROR tests/test_sessions.py::SessionTests::test_get_key_not_found - ImportEr...
ERROR tests/test_sessions.py::SessionTests::test_get_key_vague - ImportError:...
ERROR tests/test_sessions.py::SessionTests::test_get_objects - ImportError: c...
ERROR tests/test_sessions.py::SessionTests::test_open_session - ImportError: ...
ERROR tests/test_sessions.py::SessionTests::test_open_session_and_login_so - ...
ERROR tests/test_sessions.py::SessionTests::test_open_session_and_login_user
ERROR tests/test_sessions.py::SessionTests::test_seed_random - ImportError: c...
ERROR tests/test_threading.py::ThreadingTests::test_concurrency - ImportError...
ERROR tests/test_x509.py::X509Tests::test_import_ca_certificate - ImportError...
ERROR tests/test_x509.py::X509Tests::test_import_ca_certificate_easy - Import...
ERROR tests/test_x509.py::X509Tests::test_self_sign_certificate - ImportError...
ERROR tests/test_x509.py::X509Tests::test_sign_csr - ImportError: cannot impo...
ERROR tests/test_x509.py::X509Tests::test_verify_certificate_dsa - ImportErro...
ERROR tests/test_x509.py::X509Tests::test_verify_certificate_ecdsa - ImportEr...
ERROR tests/test_x509.py::X509Tests::test_verify_certificate_rsa - ImportErro...
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_double_initialise
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_double_initialise_different_libs
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_get_mechanism_info
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_get_mechanism_info_ec
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_get_mechanisms
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_get_slots - ...
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_get_token - ...
FAILED tests/test_slots_and_tokens.py::SlotsAndTokensTests::test_get_tokens
=================== 8 failed, 1 warning, 62 errors in 0.53s ====================
Usually something like that is caused by use relative imports which is usually nothing more than just asking for troubles beause it forces exact location of the DSO during testting using "test as installed" methodology.

@kloczek
Copy link
Author

kloczek commented Feb 28, 2023

Yep .. relative imports are used on massive sacale 🤔

[tkloczko@pers-jacek python-pkcs11-0.7.0]$ grep -r import | grep " \."
pkcs11/__init__.py:from .constants import *  # noqa: F403
pkcs11/__init__.py:from .exceptions import *  # noqa: F403
pkcs11/__init__.py:from .mechanisms import *  # noqa: F403
pkcs11/__init__.py:from .types import *  # noqa: F403
pkcs11/__init__.py:    from . import _pkcs11
pkcs11/_errors.pyx:from .exceptions import *
pkcs11/_pkcs11.pyx:    from . cimport _mswin as mswin
pkcs11/_pkcs11.pyx:from ._pkcs11_defn cimport *
pkcs11/_pkcs11.pyx:from . import types
pkcs11/_pkcs11.pyx:from .defaults import *
pkcs11/_pkcs11.pyx:from .exceptions import *
pkcs11/_pkcs11.pyx:from .constants import *
pkcs11/_pkcs11.pyx:from .mechanisms import *
pkcs11/_pkcs11.pyx:from .types import (
pkcs11/_utils.pyx:from .constants import *
pkcs11/_utils.pyx:from .mechanisms import *
pkcs11/defaults.py:from .constants import (
pkcs11/defaults.py:from .mechanisms import Mechanism, KeyType, MGF
pkcs11/types.py:from .constants import (
pkcs11/types.py:from .mechanisms import KeyType, Mechanism
pkcs11/types.py:from .exceptions import (
pkcs11/util/dh.py:from . import biginteger
pkcs11/util/dh.py:from ..constants import Attribute
pkcs11/util/dh.py:from ..exceptions import AttributeTypeInvalid
pkcs11/util/dsa.py:from . import biginteger
pkcs11/util/dsa.py:from ..constants import Attribute
pkcs11/util/ec.py:from ..constants import Attribute, ObjectClass
pkcs11/util/ec.py:from ..mechanisms import KeyType
pkcs11/util/rsa.py:from . import biginteger
pkcs11/util/rsa.py:from ..constants import Attribute, ObjectClass, MechanismFlag
pkcs11/util/rsa.py:from ..mechanisms import KeyType
pkcs11/util/rsa.py:from ..defaults import DEFAULT_KEY_CAPABILITIES
pkcs11/util/x509.py:from ..constants import Attribute, ObjectClass, CertificateType
pkcs11/util/x509.py:from ..mechanisms import KeyType
pkcs11/util/x509.py:        from .rsa import decode_rsa_public_key
pkcs11/util/x509.py:        from .dsa import decode_dsa_domain_parameters, decode_dsa_public_key
pkcs11/_pkcs11.c: * from .exceptions import *             # <<<<<<<<<<<<<<
pkcs11/_pkcs11.c: * from .constants import *             # <<<<<<<<<<<<<<
pkcs11/_pkcs11.c: * from .mechanisms import *
pkcs11/_pkcs11.c: * from .constants import *
pkcs11/_pkcs11.c: * from .mechanisms import *             # <<<<<<<<<<<<<<
pkcs11/_pkcs11.c: * from . import types             # <<<<<<<<<<<<<<
pkcs11/_pkcs11.c: * from .defaults import *
pkcs11/_pkcs11.c: * from .exceptions import *
pkcs11/_pkcs11.c: * from . import types
pkcs11/_pkcs11.c: * from .defaults import *             # <<<<<<<<<<<<<<
pkcs11/_pkcs11.c: * from .exceptions import *
pkcs11/_pkcs11.c: * from .constants import *
pkcs11/_pkcs11.c: * from . import types
pkcs11/_pkcs11.c: * from .defaults import *
pkcs11/_pkcs11.c: * from .exceptions import *             # <<<<<<<<<<<<<<
pkcs11/_pkcs11.c: * from .constants import *
pkcs11/_pkcs11.c: * from .mechanisms import *
pkcs11/_pkcs11.c: * from .defaults import *
pkcs11/_pkcs11.c: * from .exceptions import *
grep: pkcs11/_pkcs11.c: * from .constants import *             # <<<<<<<<<<<<<<
pkcs11/__pycache__/types.cpython-38.pyc: binary file matchespkcs11/_pkcs11.c: * from .mechanisms import *

pkcs11/_pkcs11.c: * from .types import (
pkcs11/_pkcs11.c: * from .exceptions import *
pkcs11/_pkcs11.c: * from .constants import *
pkcs11/_pkcs11.c: * from .mechanisms import *             # <<<<<<<<<<<<<<
pkcs11/_pkcs11.c: * from .types import (
pkcs11/_pkcs11.c: * from .mechanisms import *
pkcs11/_pkcs11.c: * from .types import (
pkcs11/_pkcs11.c: * from .constants import *
pkcs11/_pkcs11.c: * from .mechanisms import *
pkcs11/_pkcs11.c: * from .types import (             # <<<<<<<<<<<<<<
tests/test_aes.py:from . import TestCase, requires, FIXME
tests/test_des.py:from . import TestCase, requires
tests/test_dh.py:from . import TestCase, requires, FIXME
tests/test_digest.py:from . import TestCase, Not, requires
tests/test_dsa.py:from . import TestCase, requires, FIXME
tests/test_ecc.py:from . import TestCase, requires
tests/test_iterators.py:from . import TestCase, requires
tests/test_public_key_external.py:from . import TestCase, requires, Is
tests/test_rsa.py:from . import TestCase, requires, FIXME
tests/test_sessions.py:from . import TestCase, TOKEN_PIN, TOKEN_SO_PIN, Not, Only, requires, FIXME
tests/test_slots_and_tokens.py:from . import LIB, TOKEN, Only, Not
tests/test_threading.py:from . import TestCase, Not, requires
tests/test_x509.py:from . import TestCase, Not, Only, requires, OPENSSL

@kloczek
Copy link
Author

kloczek commented Feb 28, 2023

Sometimes is relative imports are not overused it is possible to start tests with --import-mode=importlib but in this case it did not help and with that pytest is not able o tests.

+ /usr/bin/pytest -ra -m 'not network' --import-mode=importlib
============================= test session starts ==============================
platform linux -- Python 3.8.16, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0
collected 0 items / 13 errors

==================================== ERRORS ====================================
______________________ ERROR collecting tests/test_aes.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_aes.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_aes.py:8: in <module>
    from . import TestCase, requires, FIXME
E   ModuleNotFoundError: No module named 'tests'
______________________ ERROR collecting tests/test_des.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_des.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_des.py:8: in <module>
    from . import TestCase, requires
E   ModuleNotFoundError: No module named 'tests'
______________________ ERROR collecting tests/test_dh.py _______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_dh.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_dh.py:14: in <module>
    from . import TestCase, requires, FIXME
E   ModuleNotFoundError: No module named 'tests'
____________________ ERROR collecting tests/test_digest.py _____________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_digest.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_digest.py:9: in <module>
    from . import TestCase, Not, requires
E   ModuleNotFoundError: No module named 'tests'
______________________ ERROR collecting tests/test_dsa.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_dsa.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_dsa.py:14: in <module>
    from . import TestCase, requires, FIXME
E   ModuleNotFoundError: No module named 'tests'
______________________ ERROR collecting tests/test_ecc.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_ecc.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_ecc.py:17: in <module>
    from . import TestCase, requires
E   ModuleNotFoundError: No module named 'tests'
___________________ ERROR collecting tests/test_iterators.py ___________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_iterators.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_iterators.py:9: in <module>
    from . import TestCase, requires
E   ModuleNotFoundError: No module named 'tests'
______________ ERROR collecting tests/test_public_key_external.py ______________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_public_key_external.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_public_key_external.py:10: in <module>
    from . import TestCase, requires, Is
E   ModuleNotFoundError: No module named 'tests'
______________________ ERROR collecting tests/test_rsa.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_rsa.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_rsa.py:8: in <module>
    from . import TestCase, requires, FIXME
E   ModuleNotFoundError: No module named 'tests'
___________________ ERROR collecting tests/test_sessions.py ____________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_sessions.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_sessions.py:7: in <module>
    from . import TestCase, TOKEN_PIN, TOKEN_SO_PIN, Not, Only, requires, FIXME
E   ModuleNotFoundError: No module named 'tests'
_______________ ERROR collecting tests/test_slots_and_tokens.py ________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_slots_and_tokens.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_slots_and_tokens.py:9: in <module>
    from . import LIB, TOKEN, Only, Not
E   ModuleNotFoundError: No module named 'tests'
___________________ ERROR collecting tests/test_threading.py ___________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_threading.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_threading.py:12: in <module>
    from . import TestCase, Not, requires
E   ModuleNotFoundError: No module named 'tests'
_____________________ ERROR collecting tests/test_x509.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/python-pkcs11-0.7.0/tests/test_x509.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_x509.py:25: in <module>
    from . import TestCase, Not, Only, requires, OPENSSL
E   ModuleNotFoundError: No module named 'tests'
=========================== short test summary info ============================
ERROR tests/test_aes.py
ERROR tests/test_des.py
ERROR tests/test_dh.py
ERROR tests/test_digest.py
ERROR tests/test_dsa.py
ERROR tests/test_ecc.py
ERROR tests/test_iterators.py
ERROR tests/test_public_key_external.py
ERROR tests/test_rsa.py
ERROR tests/test_sessions.py
ERROR tests/test_slots_and_tokens.py
ERROR tests/test_threading.py
ERROR tests/test_x509.py
!!!!!!!!!!!!!!!!!!! Interrupted: 13 errors during collection !!!!!!!!!!!!!!!!!!!
============================== 13 errors in 0.19s ==============================

@kloczek
Copy link
Author

kloczek commented Mar 30, 2024

Gentle ping .. any update? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants