Use the __version__ variable from tests.support.mock

This commit is contained in:
Pedro Algarvio 2017-03-06 12:53:00 +00:00
parent 187da80f4a
commit d13b40554b
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF
2 changed files with 4 additions and 6 deletions

View File

@ -9,7 +9,6 @@
# Import Python libs
from __future__ import absolute_import
from distutils.version import LooseVersion
import mock
try:
import libcloud.security
@ -23,7 +22,7 @@ from salt.exceptions import SaltCloudSystemExit
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock import MagicMock, NO_MOCK, NO_MOCK_REASON, patch
from tests.support.mock import MagicMock, NO_MOCK, NO_MOCK_REASON, patch, __version__ as mock_version
# Global Variables
dimensiondata.__active_provider_name__ = ''
@ -149,7 +148,7 @@ class DimensionDataTestCase(ExtendedTestCase):
with patch('salt.config.check_driver_dependencies', return_value=True) as p:
get_deps = dimensiondata.get_dependencies()
self.assertEqual(get_deps, True)
if LooseVersion(mock.__version__) >= LooseVersion('2.0.0'):
if LooseVersion(mock_version) >= LooseVersion('2.0.0'):
self.assertTrue(p.call_count >= 1)
def test_provider_matches(self):

View File

@ -9,7 +9,6 @@
# Import Python libs
from __future__ import absolute_import
from distutils.version import LooseVersion
import mock
try:
import libcloud.security
@ -23,7 +22,7 @@ from salt.exceptions import SaltCloudSystemExit
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, patch
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, patch, __version__ as mock_version
# Global Variables
gce.__active_provider_name__ = ''
@ -94,7 +93,7 @@ class GCETestCase(TestCase):
with patch('salt.config.check_driver_dependencies', return_value=True) as p:
get_deps = gce.get_dependencies()
self.assertEqual(get_deps, True)
if LooseVersion(mock.__version__) >= LooseVersion('2.0.0'):
if LooseVersion(mock_version) >= LooseVersion('2.0.0'):
p.assert_called_once()
def test_provider_matches(self):