Skip encrypted type tests if cryptography not installed

This commit is contained in:
Konsta Vesterinen
2014-10-14 16:07:36 +03:00
parent a859c8ccd1
commit 34ed8deaf0

View File

@@ -1,11 +1,18 @@
import sqlalchemy as sa import sqlalchemy as sa
from pytest import mark
cryptography = None
try:
import cryptography
except ImportError:
pass
from tests import TestCase from tests import TestCase
from sqlalchemy_utils import EncryptedType from sqlalchemy_utils import EncryptedType
from sqlalchemy_utils.types.encrypted import AesEngine from sqlalchemy_utils.types.encrypted import AesEngine, FernetEngine
from sqlalchemy_utils.types.encrypted import FernetEngine
@mark.skipif('cryptography is None')
class EncryptedTypeTestCase(TestCase): class EncryptedTypeTestCase(TestCase):
def setup_method(self, method): def setup_method(self, method):
# set some test values # set some test values
self.test_key = 'secretkey1234' self.test_key = 'secretkey1234'