mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add error-handling function to shutil.rmtree
This commit is contained in:
parent
81695a9f3c
commit
45be32666a
1 changed files with 6 additions and 1 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Reference in a new issue