mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Lint: remove duplicate function in helpers.py
This commit is contained in:
parent
75480158b3
commit
2ad60c7e81
1 changed files with 0 additions and 26 deletions
|
@ -1046,32 +1046,6 @@ class WithTempdir(object):
|
|||
with_tempdir = WithTempdir
|
||||
|
||||
|
||||
class WithTempdir(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.create = kwargs.pop('create', True)
|
||||
if 'dir' not in kwargs:
|
||||
kwargs['dir'] = TMP
|
||||
self.kwargs = kwargs
|
||||
|
||||
def __call__(self, func):
|
||||
self.func = func
|
||||
return functools.wraps(func)(
|
||||
lambda testcase, *args, **kwargs: self.wrap(testcase, *args, **kwargs) # pylint: disable=W0108
|
||||
)
|
||||
|
||||
def wrap(self, testcase, *args, **kwargs):
|
||||
tempdir = tempfile.mkdtemp(**self.kwargs)
|
||||
if not self.create:
|
||||
os.rmdir(tempdir)
|
||||
try:
|
||||
return self.func(testcase, tempdir, *args, **kwargs)
|
||||
finally:
|
||||
shutil.rmtree(tempdir, ignore_errors=True)
|
||||
|
||||
|
||||
with_tempdir = WithTempdir
|
||||
|
||||
|
||||
def requires_system_grains(func):
|
||||
'''
|
||||
Function decorator which loads and passes the system's grains to the test
|
||||
|
|
Loading…
Add table
Reference in a new issue