mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Skip the rvm and gem module/state tests when mock is missing
The mock python module is required for the gem and rvm tests. If it is not available, the tests should be gracefully skipped. From python runtests.py -u: test__check_and_install_ruby (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable' test__check_ruby (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable' test__check_rvm (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable' test_gemset_present (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable' test_installed (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable' test_installed (unit.states.gem_test.TestGemState) ... skipped 'mock python module is unavailable' test_removed (unit.states.gem_test.TestGemState) ... skipped 'mock python module is unavailable' test__rvm (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable' test__rvm_do (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable' test_gemset_list (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable' test_gemset_list_all (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable' test_install (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable' test_list (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable' test__gem (unit.modules.gem_test.TestGemModule) ... skipped 'mock python module is unavailable' test_list (unit.modules.gem_test.TestGemModule) ... skipped 'mock python module is unavailable' test_sources_list (unit.modules.gem_test.TestGemModule) ... skipped 'mock python module is unavailable'
This commit is contained in:
parent
7424738dc9
commit
07b4c8b4ed
@ -3,13 +3,18 @@ import os
|
||||
sys.path.insert(
|
||||
0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
|
||||
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner
|
||||
from mock import MagicMock, patch
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner, skipIf
|
||||
try:
|
||||
from mock import MagicMock, patch
|
||||
has_mock = True
|
||||
except ImportError:
|
||||
has_mock = False
|
||||
|
||||
import salt.modules.gem as gem
|
||||
gem.__salt__ = {}
|
||||
|
||||
|
||||
@skipIf(has_mock is False, "mock python module is unavailable")
|
||||
class TestGemModule(TestCase):
|
||||
|
||||
def test__gem(self):
|
||||
|
@ -3,14 +3,20 @@ import os
|
||||
sys.path.insert(
|
||||
0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
|
||||
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner
|
||||
from mock import MagicMock, patch
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner, skipIf
|
||||
try:
|
||||
from mock import MagicMock, patch
|
||||
has_mock = True
|
||||
except ImportError:
|
||||
has_mock = False
|
||||
|
||||
import salt.modules.rvm as rvm
|
||||
rvm.__salt__ = {
|
||||
'cmd.has_exec': MagicMock(return_value=True)}
|
||||
if has_mock:
|
||||
import salt.modules.rvm as rvm
|
||||
rvm.__salt__ = {
|
||||
'cmd.has_exec': MagicMock(return_value=True)}
|
||||
|
||||
|
||||
@skipIf(has_mock is False, "mock python module is unavailable")
|
||||
class TestRvmModule(TestCase):
|
||||
|
||||
def test__rvm(self):
|
||||
|
@ -3,14 +3,19 @@ import os
|
||||
sys.path.insert(
|
||||
0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
|
||||
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner
|
||||
from mock import MagicMock, patch
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner, skipIf
|
||||
try:
|
||||
from mock import MagicMock, patch
|
||||
has_mock = True
|
||||
except ImportError:
|
||||
has_mock = False
|
||||
|
||||
import salt.states.gem as gem
|
||||
gem.__salt__ = {}
|
||||
gem.__opts__ = {'test': False}
|
||||
|
||||
|
||||
@skipIf(has_mock is False, "mock python module is unavailable")
|
||||
class TestGemState(TestCase):
|
||||
|
||||
def test_installed(self):
|
||||
|
@ -3,14 +3,19 @@ import os
|
||||
sys.path.insert(
|
||||
0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
|
||||
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner
|
||||
from mock import MagicMock, patch
|
||||
from saltunittest import TestCase, TestLoader, TextTestRunner, skipIf
|
||||
try:
|
||||
from mock import MagicMock, patch
|
||||
has_mock = True
|
||||
except ImportError:
|
||||
has_mock = False
|
||||
|
||||
import salt.states.rvm as rvm
|
||||
rvm.__salt__ = {}
|
||||
rvm.__opts__ = {'test': False}
|
||||
|
||||
|
||||
@skipIf(has_mock is False, "mock python module is unavailable")
|
||||
class TestRvmState(TestCase):
|
||||
|
||||
def test__check_rvm(self):
|
||||
|
Loading…
Reference in New Issue
Block a user