From a3b9ac5ab3534efd510c2be4f4c12391e4084398 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Thu, 28 Sep 2017 13:44:54 -0400 Subject: [PATCH] Alter how the tests determine if cryptography is available Rather than re-importing cryptography and m2crypto to detect what tests to run in the test module, just import from the x509_ng module. This fixes issues when running the tests with an old pyOpenSSL library that doesn't provide the APIs we need. Signed-off-by: Jeremy Cline --- fedmsg/tests/crypto/test_x509.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/fedmsg/tests/crypto/test_x509.py b/fedmsg/tests/crypto/test_x509.py index 65fb3f7e..114d2dc9 100644 --- a/fedmsg/tests/crypto/test_x509.py +++ b/fedmsg/tests/crypto/test_x509.py @@ -24,26 +24,14 @@ import mock import six -_m2crypto, _cryptography = False, False -try: - import M2Crypto # noqa: F401 - import m2ext # noqa: F401 - _m2crypto = True -except ImportError: - pass -try: - import cryptography # noqa - import OpenSSL # noqa - _cryptography = True -except ImportError: - pass - try: from unittest import skipIf, TestCase, expectedFailure except ImportError: from unittest2 import skipIf, TestCase, expectedFailure from fedmsg import crypto # noqa: E402 +from fedmsg.crypto.x509 import _m2crypto +from fedmsg.crypto.x509_ng import _cryptography from fedmsg.tests.base import SSLDIR # noqa: E402