Merge pull request #41657 from gtmanfred/nitrogen

Disable libcloud test if the module doesn't load
This commit is contained in:
Nicole Thomas 2017-06-09 08:58:06 -06:00 committed by GitHub
commit 55ac7312bf

View File

@ -1,9 +1,25 @@
# -*- 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