Merge pull request #52753 from twangboy/skip_test_gen_thin

Skip test_gen_thin_compression_fallback_py3
This commit is contained in:
Daniel Wozniak 2019-04-29 20:36:26 -07:00 committed by GitHub
commit 3e46f5143d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -327,8 +327,10 @@ def _get_thintar_prefix(tarname):
:param tarname: name of the chosen tarball
:return: prefixed tarname
'''
tfd, tmp_tarname = tempfile.mkstemp(dir=os.path.dirname(tarname), prefix=".thin-",
suffix="." + os.path.basename(tarname).split(".", 1)[-1])
tfd, tmp_tarname = tempfile.mkstemp(
dir=os.path.dirname(tarname),
prefix=".thin-",
suffix=os.path.splitext(tarname)[1])
os.close(tfd)
return tmp_tarname
@ -458,7 +460,6 @@ def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods='',
elif compress == 'zip':
tfp = zipfile.ZipFile(tmp_thintar, 'w', compression=zlib and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED)
tfp.add = tfp.write
try: # cwd may not exist if it was removed but salt was run from it
start_dir = os.getcwd()
except OSError:

View file

@ -17,6 +17,7 @@ import salt.exceptions
from salt.utils import thin
from salt.utils import json
import salt.utils.stringutils
import salt.utils.platform
from salt.utils.stringutils import to_bytes as bts
from salt.ext.six.moves import range
@ -423,6 +424,8 @@ class SSHThinTestCase(TestCase):
self.assertIn('The minimum required python version to run salt-ssh is '
'"2.6"', str(err.value))
@skipIf(salt.utils.platform.is_windows() and thin._six.PY2,
'Dies on Python2 on Windows')
@patch('salt.exceptions.SaltSystemExit', Exception)
@patch('salt.utils.thin.log', MagicMock())
@patch('salt.utils.thin.os.makedirs', MagicMock())