Merge branch '2018.3' into fix-typeerror-unicode

This commit is contained in:
Jacob Weinstock 2018-08-22 12:24:31 -06:00 committed by GitHub
commit 25608ef119
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 10 deletions

View file

@ -265,10 +265,10 @@ def _git_run(command, cwd=None, user=None, password=None, identity=None,
# copy wrapper to area accessible by ``runas`` user
# currently no support in windows for wrapping git ssh
ssh_id_wrapper = os.path.join(
ssh_id_wrapper = os.path.abspath(os.path.join(
salt.utils.templates.TEMPLATE_DIRNAME,
'git/ssh-id-wrapper'
)
))
tmp_ssh_wrapper = None
if salt.utils.platform.is_windows():
ssh_exe = _find_ssh_exe()

View file

@ -38,6 +38,7 @@ from salt.ext.six.moves import queue
log = logging.getLogger(__name__)
@flaky
class StateRunnerTest(ShellCase):
'''
Test the state runner.
@ -51,7 +52,6 @@ class StateRunnerTest(ShellCase):
q.put(ret)
q.task_done()
@flaky
def test_orchestrate_output(self):
'''
Ensure the orchestrate runner outputs useful state data.
@ -301,6 +301,7 @@ class StateRunnerTest(ShellCase):
@skipIf(salt.utils.platform.is_windows(), '*NIX-only test')
@flaky
class OrchEventTest(ShellCase):
'''
Tests for orchestration events

View file

@ -161,6 +161,7 @@ class CallTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMixin
self.assertTrue(True in ['returnTOmaster' in a for a in master_out])
@skipIf(sys.platform.startswith('win'), 'This test does not apply on Win')
@flaky
def test_issue_2731_masterless(self):
root_dir = os.path.join(TMP, 'issue-2731')
config_dir = os.path.join(root_dir, 'conf')
@ -366,6 +367,7 @@ class CallTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMixin
if os.path.isdir(config_dir):
shutil.rmtree(config_dir)
@flaky
def test_issue_15074_output_file_append(self):
output_file_append = os.path.join(TMP, 'issue-15074')
try:

View file

@ -740,7 +740,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
source='salt://issue-48777/new.html')
ret = ret[next(iter(ret))]
assert ret['result'] is True, ret
diff_lines = ret['changes']['diff'].split('\n')
diff_lines = ret['changes']['diff'].split(os.linesep)
assert '+räksmörgås' in diff_lines, diff_lines
def test_directory(self):
@ -1273,8 +1273,15 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
name=name,
source='salt://соль')
self.assertSaltTrueReturn(ret)
if six.PY2 and salt.utils.platform.is_windows():
# Providing unicode to os.listdir so that we avoid having listdir
# try to decode the filenames using the systemencoding on windows
# python 2.
files = os.listdir(name.decode('utf-8'))
else:
files = salt.utils.data.decode(os.listdir(name), normalize=True)
self.assertEqual(
sorted(salt.utils.data.decode(os.listdir(name), normalize=True)),
sorted(files),
sorted(['foo.txt', 'спам.txt', 'яйца.txt']),
)
@ -2207,10 +2214,10 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
else:
diff = '--- \n+++ \n@@ -1 +1,3 @@\n'
diff += (
'+첫 번째 행\n'
' 한국어 시험\n'
'+마지막 행\n'
)
'+첫 번째 행{0}'
' 한국어 시험{0}'
'+마지막 행{0}'
).format(os.linesep)
ret = {x.split('_|-')[1]: y for x, y in six.iteritems(result)}

View file

@ -68,7 +68,7 @@ class RootsTest(TestCase, AdaptedConfigurationTestCaseMixin, LoaderModuleMockMix
with salt.utils.files.fopen(full_path_to_file, 'rb') as s_fp:
with salt.utils.files.fopen(os.path.join(cls.tmp_dir, 'testfile'), 'wb') as d_fp:
for line in s_fp:
d_fp.write(line.rstrip(b'\n').rstrip(b'\r') + b'\n')
d_fp.write(line)
@classmethod
def tearDownClass(cls):

View file

@ -527,6 +527,7 @@ class FileBlockReplaceTestCase(TestCase, LoaderModuleMockMixin):
)
@skipIf(salt.platform.is_windows(), 'Skip on windows')
class FileGrepTestCase(TestCase, LoaderModuleMockMixin):
def setup_loader_modules(self):
return {