Disable libcloud test if the module doesn't load

This is causing the mac tests to fail.  apache-libcloud 0.20.1 is what is being
imported, and the libcloud_dns module is not being used.
This commit is contained in:
Daniel Wallace 2017-06-08 11:25:35 -06:00
parent c5eee0a3a8
commit 5010e1a89d

View File

@ -1,9 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# import salt libs
from salt.utils.versions import LooseVersion as _LooseVersion
# Import test Helpers
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
REQUIRED_LIBCLOUD_VERSION = '0.21.0'
try:
import libcloud
#pylint: enable=unused-import
if _LooseVersion(getattr(libcloud, '__version__', '0.0.0')) < _LooseVersion(REQUIRED_LIBCLOUD_VERSION):
raise ImportError()
HAS_LIBCLOUD = True
except ImportError:
HAS_LIBCLOUD = False
@skipIf(not HAS_LIBCLOUD, 'Requires libcloud >= {0}'.format(REQUIRED_LIBCLOUD_VERSION))
class LibcloudDNSTest(ModuleCase):
'''
Validate the libcloud_dns module