mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #45338 from twangboy/win_fix_test_ansiblegate
Fix `unit.modules.test_ansiblegate` for Windows
This commit is contained in:
commit
bef1e070aa
@ -38,6 +38,7 @@ import subprocess
|
||||
|
||||
import salt.utils.json
|
||||
from salt.exceptions import LoaderError, CommandExecutionError
|
||||
import salt.utils.platform
|
||||
import salt.utils.timed_subprocess
|
||||
import salt.utils.yaml
|
||||
from salt.ext import six
|
||||
@ -216,6 +217,8 @@ def __virtual__():
|
||||
Ansible module caller.
|
||||
:return:
|
||||
'''
|
||||
if salt.utils.platform.is_windows():
|
||||
return False, "The ansiblegate module isn't supported on Windows"
|
||||
ret = ansible is not None
|
||||
msg = not ret and "Ansible is not installed on this system" or None
|
||||
if ret:
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
# Import Salt Testing Libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import os
|
||||
try:
|
||||
import pytest
|
||||
except ImportError as import_error:
|
||||
@ -33,18 +34,20 @@ from tests.support.mock import (
|
||||
)
|
||||
|
||||
import salt.modules.ansiblegate as ansible
|
||||
import salt.utils.platform
|
||||
from salt.exceptions import LoaderError
|
||||
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
@skipIf(NO_PYTEST, False)
|
||||
@skipIf(salt.utils.platform.is_windows(), 'Not supported on Windows')
|
||||
class AnsiblegateTestCase(TestCase, LoaderModuleMockMixin):
|
||||
def setUp(self):
|
||||
self.resolver = ansible.AnsibleModuleResolver({})
|
||||
self.resolver._modules_map = {
|
||||
'one.two.three': '/one/two/three.py',
|
||||
'four.five.six': '/four/five/six.py',
|
||||
'three.six.one': '/three/six/one.py',
|
||||
'one.two.three': os.sep + os.path.join('one', 'two', 'three.py'),
|
||||
'four.five.six': os.sep + os.path.join('four', 'five', 'six.py'),
|
||||
'three.six.one': os.sep + os.path.join('three', 'six', 'one.py'),
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
|
Loading…
Reference in New Issue
Block a user