PYTHONPATH=build/lib.$(DEB_BUILD_ARCH_OS)-$(shell uname -m)-$$py python$$py $$test; \
PYTHONPATH=`ls -d build/lib_d.*-$$py || ls -d build/lib.*-$$py-pydebug` python$$py-dbg $$test; \
This is missing set -e, which means the tests were failing however the packages still get built.
The build/lib.$(DEB_BUILD_ARCH_OS)-$(shell uname -m)-$$py python$$py path looks wrong. It seems to work for Python2, but Python 3 uses build/lib, so all Python3 tests fail.
Any ideas how to fix this? I am not so familiar with packaging C libraries for Python. I suspect the debian/rules file could be cleaned up a lot.
Upstream provides a runtests.py - however that relies on twisted, which is not available for Python3. Have been told that twisted may not be available for Python 3 until after Python 3.5 is released in fact.
debian/rules override_dh_auto_test
make[1]: Entering directory '/«PKGBUILDDIR»'
# run tests
for py in 2.7 3.4; do \
for test in OpenSSL/test/test*; do \
echo "running $test for python$py ..."; \
PYTHONPATH=build/lib.linux-x86_64-$py python$py $test; \
PYTHONPATH=`ls -d build/lib_d.*-$py || ls -d build/lib.*-$py-pydebug` python$py-dbg $test; \
done; \
done
running OpenSSL/test/test_crypto.py for python2.7 ...
................writing RSA key
....................................MAC verified OK
MAC verified OK
..MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
...unable to write 'random state'
.......MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
MAC verified OK
....................................................F.............................FEE....................................
======================================================================
ERROR: test_extension_count (__main__.X509Tests)However, question about the
----------------------------------------------------------------------
Traceback (most recent call last):
File "OpenSSL/test/test_crypto.py", line 1483, in test_extension_count
c = self._extcert(pkey, [])
File "OpenSSL/test/test_crypto.py", line 1468, in _extcert
FILETYPE_PEM, dump_certificate(FILETYPE_PEM, cert))
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7/OpenSSL/crypto.py", line 1219, in load_certificate
_raise_current_error()
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7/OpenSSL/_util.py", line 22, in exception_from_error_queue
raise exceptionType(errors)
Error: [('asn1 encoding routines', 'c2i_ASN1_OBJECT', 'invalid object encoding'), ('asn1 encoding routines', 'ASN1_TEMPLATE_NOEXP_D2I', 'nested asn1 error'), ('asn1 encoding routines', 'ASN1_TEMPLATE_NOEXP_D2I', 'nested asn1 error'), ('asn1 encoding routines', 'ASN1_TEMPLATE_NOEXP_D2I', 'nested asn1 error'), ('PEM routines', 'PEM_ASN1_read_bio', 'ASN1 lib')]
======================================================================
ERROR: test_get_extension (__main__.X509Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OpenSSL/test/test_crypto.py", line 1506, in test_get_extension
cert = self._extcert(pkey, [ca, key, subjectAltName])
File "OpenSSL/test/test_crypto.py", line 1468, in _extcert
FILETYPE_PEM, dump_certificate(FILETYPE_PEM, cert))
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7/OpenSSL/crypto.py", line 1219, in load_certificate
_raise_current_error()
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7/OpenSSL/_util.py", line 22, in exception_from_error_queue
raise exceptionType(errors)
Error: [('asn1 encoding routines', 'c2i_ASN1_OBJECT', 'invalid object encoding'), ('asn1 encoding routines', 'ASN1_TEMPLATE_NOEXP_D2I', 'nested asn1 error'), ('asn1 encoding routines', 'ASN1_TEMPLATE_NOEXP_D2I', 'nested asn1 error'), ('asn1 encoding routines', 'ASN1_TEMPLATE_NOEXP_D2I', 'nested asn1 error'), ('PEM routines', 'PEM_ASN1_read_bio', 'ASN1 lib')]
======================================================================
FAIL: test_der (__main__.X509NameTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OpenSSL/test/test_crypto.py", line 907, in test_der
b('0\x1b1\x0b0\t\x06\x03U\x04\x06\x13\x02US'
AssertionError: '0\x1b1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x0c0\n\x06\x03U\x04\x03\x0c\x03foo' != '0\x1b1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x0c0\n\x06\x03U\x04\x03\x13\x03foo'
======================================================================
FAIL: test_digest (__main__.X509Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OpenSSL/test/test_crypto.py", line 1454, in test_digest
b("A8:EB:07:F8:53:25:0A:F2:56:05:C5:A5:C4:C4:C7:15"))
AssertionError: '6E:DB:AA:35:8C:39:8C:86:95:0E:D6:51:7E:42:FF:F4' != 'A8:EB:07:F8:53:25:0A:F2:56:05:C5:A5:C4:C4:C7:15'
----------------------------------------------------------------------
Ran 185 tests in 0.775s
FAILED (failures=2, errors=2)
ls: cannot access build/lib_d.*-2.7: No such file or directory
Traceback (most recent call last):
File "OpenSSL/test/test_crypto.py", line 16, in <module>
from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, Error, PKey, PKeyType
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/_util.py", line 4, in <module>
binding = Binding()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in __init__
self._ensure_ffi_initialized()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 109, in _ensure_ffi_initialized
libraries=libraries,
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/utils.py", line 39, in build_ffi
ffi = cffi.FFI()
File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 56, in __init__
import _cffi_backend as backend
[55171 refs]
running OpenSSL/test/test_rand.py for python2.7 ...
.................
----------------------------------------------------------------------
Ran 17 tests in 0.021s
OK
ls: cannot access build/lib_d.*-2.7: No such file or directory
Traceback (most recent call last):
File "OpenSSL/test/test_rand.py", line 13, in <module>
from OpenSSL.test.util import TestCase, b
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/_util.py", line 4, in <module>
binding = Binding()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in __init__
self._ensure_ffi_initialized()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 109, in _ensure_ffi_initialized
libraries=libraries,
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/utils.py", line 39, in build_ffi
ffi = cffi.FFI()
File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 56, in __init__
import _cffi_backend as backend
[54489 refs]
running OpenSSL/test/test_ssl.py for python2.7 ...
................................................F........................................E............................................................
======================================================================
ERROR: test_set_default_verify_paths (__main__.ContextTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OpenSSL/test/test_ssl.py", line 933, in test_set_default_verify_paths
clientSSL.do_handshake()
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7/OpenSSL/SSL.py", line 1076, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7/OpenSSL/SSL.py", line 871, in _raise_ssl_error
_raise_current_error()
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7/OpenSSL/_util.py", line 22, in exception_from_error_queue
raise exceptionType(errors)
Error: [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')]
======================================================================
FAIL: test_wantWriteError (__main__.ConnectionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OpenSSL/test/test_ssl.py", line 1925, in test_wantWriteError
"Failed to fill socket buffer, cannot test BIO want write")
AssertionError: Failed to fill socket buffer, cannot test BIO want write
----------------------------------------------------------------------
Ran 150 tests in 1.434s
FAILED (failures=1, errors=1)
ls: cannot access build/lib_d.*-2.7: No such file or directory
Traceback (most recent call last):
File "OpenSSL/test/test_ssl.py", line 19, in <module>
from OpenSSL.crypto import TYPE_RSA, FILETYPE_PEM
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/«PKGBUILDDIR»/build/lib.linux-x86_64-2.7-pydebug/OpenSSL/_util.py", line 4, in <module>
binding = Binding()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in __init__
self._ensure_ffi_initialized()
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 109, in _ensure_ffi_initialized
libraries=libraries,
File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/utils.py", line 39, in build_ffi
ffi = cffi.FFI()
File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 56, in __init__
import _cffi_backend as backend
[57013 refs]
running OpenSSL/test/test_crypto.py for python3.4 ...
Traceback (most recent call last):
File "OpenSSL/test/test_crypto.py", line 16, in <module>
from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, Error, PKey, PKeyType
ImportError: No module named 'OpenSSL'
ls: cannot access build/lib_d.*-3.4: No such file or directory
ls: cannot access build/lib.*-3.4-pydebug: No such file or directory
Traceback (most recent call last):
File "OpenSSL/test/test_crypto.py", line 16, in <module>
from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, Error, PKey, PKeyType
ImportError: No module named 'OpenSSL'
running OpenSSL/test/test_rand.py for python3.4 ...
Traceback (most recent call last):
File "OpenSSL/test/test_rand.py", line 13, in <module>
from OpenSSL.test.util import TestCase, b
ImportError: No module named 'OpenSSL'
ls: cannot access build/lib_d.*-3.4: No such file or directory
ls: cannot access build/lib.*-3.4-pydebug: No such file or directory
Traceback (most recent call last):
File "OpenSSL/test/test_rand.py", line 13, in <module>
from OpenSSL.test.util import TestCase, b
ImportError: No module named 'OpenSSL'
running OpenSSL/test/test_ssl.py for python3.4 ...
Traceback (most recent call last):
File "OpenSSL/test/test_ssl.py", line 19, in <module>
from OpenSSL.crypto import TYPE_RSA, FILETYPE_PEM
ImportError: No module named 'OpenSSL'
ls: cannot access build/lib_d.*-3.4: No such file or directory
ls: cannot access build/lib.*-3.4-pydebug: No such file or directory
Traceback (most recent call last):
File "OpenSSL/test/test_ssl.py", line 19, in <module>
from OpenSSL.crypto import TYPE_RSA, FILETYPE_PEM
ImportError: No module named 'OpenSSL'
make[1]: *** [override_dh_auto_test] Error 1
debian/rules:25: recipe for target 'override_dh_auto_test' failed
make[1]: Leaving directory '/«PKGBUILDDIR»'
make: *** [build] Error 2
debian/rules:11: recipe for target 'build' failed
dpkg-buildpackage: error: debian/rules build gave error exit status 2