Running setup.py test with swig-generated bindings depends on some magic? (Cannot find the binary module)
Matěj Cepl <[email protected]>
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Organization | <>< |
| Message-ID | <[email protected]> |
Hi,
I am the maintainer of M2Crypto, which is a Python bindings for
OpenSSL using swig for generating its C module (the official
website is https://gitlab.com/m2crypto/m2crypto).
We have been using `python setup.py test` command to run the
unittest-based testsuite, but that command is going to be
deprecated (https://github.com/pypa/setuptools/issues/931) so
I am trying to find a way how to run these tests either with
pytest or with the plain `python -munittest discover -v`.
Unfortunately, when I try that my tests (perfectly working with
`python setup.py test`, of course) tend to fail with something
like:
=============================================================
ERROR: test_aes (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_aes
Traceback (most recent call last):
File "/usr/lib64/python3.8/unittest/loader.py", line 436, in _find_test_path
module = self._get_module_from_name(name)
File "/usr/lib64/python3.8/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/home/abuild/rpmbuild/BUILD/M2Crypto-0.36.0/tests/test_aes.py", line 9, in <module>
from M2Crypto import m2
File "/home/abuild/rpmbuild/BUILD/M2Crypto-0.36.0/M2Crypto/__init__.py", line 30, in <module>
from M2Crypto import (ASN1, AuthCookie, BIO, BN, DH, DSA, EVP, Engine, Err,
File "/home/abuild/rpmbuild/BUILD/M2Crypto-0.36.0/M2Crypto/ASN1.py", line 15, in <module>
from M2Crypto import BIO, m2, py27plus, six
File "/home/abuild/rpmbuild/BUILD/M2Crypto-0.36.0/M2Crypto/BIO.py", line 9, in <module>
from M2Crypto import m2, py27plus, six
File "/home/abuild/rpmbuild/BUILD/M2Crypto-0.36.0/M2Crypto/m2.py", line 30, in <module>
from M2Crypto.m2crypto import *
File "/home/abuild/rpmbuild/BUILD/M2Crypto-0.36.0/M2Crypto/m2crypto.py", line 13, in <module>
from ._m2crypto import *
ModuleNotFoundError: No module named 'M2Crypto._m2crypto'
M2Crypto.m2crypto Python module is generated by swig, but I just
cannot persuade either of these test runners to find
_m2crypto.cpython-38-x86_64-linux-gnu.so even when it is copied
directly into M2Crypto directory (of course, my efforts to set
PYTHONPATH to build/lib.linux-x86_64-3.8/M2Crypto/ were useless
as well; I tried LD_LIBRARY_PATH as well).
Is there some environmental variable I need to set or what? How
is this binary module supposed to be found?
Thank you for any suggestions,
Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: [email protected]
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
I would like to die sleeping, like my father — rather than
screaming and helpless, like his passengers.
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEPHagJ8pFrXCYtbwdeSBYAogLydgFAl+lzScACgkQeSBYAogL ydg9ZRAAo23yyEBYiGHx4rHpCV3rEBrGMNY8bwXwVtFyAJa0R35fgAuLEgnwjpyt bS+X6X47jn9eFRCTNp+pLPUzbTlSsS78D1gVSjg+AoGU1tsBcTks6+EeHuZ1VZM6 mUbC3BPgULAJXay77UvlgbVjbEIm7VEI7lFhCSr4MUvT3oqY3wAFopfk17oUQ+LC WfqYLKz/E36NhHxOzxZUkTA5SuP8VDd8FRr/zqLRsqGFpEv4tWMYnRniPaIIwjcP q5TIKnRbJssScpumD3NIPD1owC3GzxcUCTEhHF8rVjkApzZuoLNPSIwRPV7qy3+/ +VyOxPUX/oMEKBYij6fZaFmEcq/E4TimLeSO49Kkm5wO6TMa2AdJtCIejesm8r+l /xvqLKGuQJrXeUMIuwelqcAbWekszeoRuTR1NWDDfdr/yJpuc+m8FvgZDPRBoPn5 UxgxUiHXPBPxGS3LFXfwSKml46m/n9R+M1C3AGghOvGXibCLr4b5Px1qU8Uh8v5G gV6I1YbS+FLvgUOJ5VKupguK6CPceu2Vzq22wy4EnRgQmTeQbeJXD4UrOQPdeadd 8iXSlyLqHeyp63LHrxtD/XcMuYb74jbhyGffp4wzKasSOpUoriGYHXYHgtRrsa0v ftU63bD4Sxag+j+z/37Mlq81NSDIDQ9G86F1MGIxB5rKko9CL8Y= =3FEj -----END PGP SIGNATURE-----