wbond / oscrypto

Compiler-free Python crypto library backed by the OS, supporting CPython and PyPy
MIT License
321 stars 71 forks source link

tests failing with python 3.12 due to removed `imp` module #74

Closed rathann closed 1 year ago

rathann commented 1 year ago
...
+ /usr/bin/pytest -k 'not TLSTests'
============================= test session starts ==============================
platform linux -- Python 3.12.0b3, pytest-7.3.2, pluggy-1.0.0
rootdir: /builddir/build/BUILD/oscrypto-1.3.0
plugins: xdist-3.3.1
collected 0 items / 7 errors
==================================== ERRORS ====================================
__________________ ERROR collecting tests/test_asymmetric.py ___________________
ImportError while importing test module '/builddir/build/BUILD/oscrypto-1.3.0/tests/test_asymmetric.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:4: in <module>
    import imp
E   ModuleNotFoundError: No module named 'imp'
_____________________ ERROR collecting tests/test_init.py ______________________
ImportError while importing test module '/builddir/build/BUILD/oscrypto-1.3.0/tests/test_init.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:4: in <module>
    import imp
E   ModuleNotFoundError: No module named 'imp'
______________________ ERROR collecting tests/test_kdf.py ______________________
ImportError while importing test module '/builddir/build/BUILD/oscrypto-1.3.0/tests/test_kdf.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:4: in <module>
    import imp
E   ModuleNotFoundError: No module named 'imp'
_____________________ ERROR collecting tests/test_keys.py ______________________
ImportError while importing test module '/builddir/build/BUILD/oscrypto-1.3.0/tests/test_keys.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:4: in <module>
    import imp
E   ModuleNotFoundError: No module named 'imp'
___________________ ERROR collecting tests/test_symmetric.py ___________________
ImportError while importing test module '/builddir/build/BUILD/oscrypto-1.3.0/tests/test_symmetric.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:4: in <module>
    import imp
E   ModuleNotFoundError: No module named 'imp'
______________________ ERROR collecting tests/test_tls.py ______________________
ImportError while importing test module '/builddir/build/BUILD/oscrypto-1.3.0/tests/test_tls.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:4: in <module>
    import imp
E   ModuleNotFoundError: No module named 'imp'
__________________ ERROR collecting tests/test_trust_list.py ___________________
ImportError while importing test module '/builddir/build/BUILD/oscrypto-1.3.0/tests/test_trust_list.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/__init__.py:4: in <module>
    import imp
E   ModuleNotFoundError: No module named 'imp'
=========================== short test summary info ============================
ERROR tests/test_asymmetric.py
ERROR tests/test_init.py
ERROR tests/test_kdf.py
ERROR tests/test_keys.py
ERROR tests/test_symmetric.py
ERROR tests/test_tls.py
ERROR tests/test_trust_list.py
!!!!!!!!!!!!!!!!!!! Interrupted: 7 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 7 errors in 0.21s ===============================

The imp module was removed in python 3.12. Scroll down to:

...

imp importlib

... imp.find_module() | importlib.util.find_spec() ... imp.load_module() | importlib.import_module()

wbond commented 1 year ago

You interested in submitting a PR? The master branch should be in a good place CI-wise now to ensure changes don't break existing environments.

wbond commented 1 year ago

This should be fixed with the merging of #77