Merge pull request #42257 from twangboy/win_unit_pillar_test_git

Fix `unit.pillar.test_git` for Windows
This commit is contained in:
Mike Place 2017-07-17 12:51:41 -05:00 committed by GitHub
commit 3ec5bb1c2f

View file

@ -16,6 +16,7 @@ import tempfile
import shutil
import subprocess
import yaml
import stat
# Import Salt Testing libs
from tests.integration import AdaptedConfigurationTestCaseMixin
@ -72,9 +73,13 @@ class GitPillarTestCase(TestCase, AdaptedConfigurationTestCaseMixin, LoaderModul
git_pillar._update('master', 'file://{0}'.format(self.repo_path))
def tearDown(self):
shutil.rmtree(self.tmpdir)
shutil.rmtree(self.tmpdir, onerror=self._rmtree_error)
super(GitPillarTestCase, self).tearDown()
def _rmtree_error(self, func, path, excinfo):
os.chmod(path, stat.S_IWRITE)
func(path)
def _create_repo(self):
'create source Git repo in temp directory'
repo = os.path.join(self.tmpdir, 'repo_pillar')