summaryrefslogtreecommitdiffstats
path: root/tests/compat.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:12:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:12:52 +0000
commitf42dcf1d6578df945fb52fb24703e88de54ad45b (patch)
treeefd58347c05908c103cfdf8a2b3321c158a7e360 /tests/compat.py
parentAdding upstream version 2.1.0. (diff)
downloadcli-helpers-upstream/2.2.0.tar.xz
cli-helpers-upstream/2.2.0.zip
Adding upstream version 2.2.0.upstream/2.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/compat.py')
-rw-r--r--tests/compat.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/compat.py b/tests/compat.py
index 383963a..dfc57f3 100644
--- a/tests/compat.py
+++ b/tests/compat.py
@@ -28,7 +28,7 @@ class _TempDirectory(object):
name = None
_closed = False
- def __init__(self, suffix="", prefix='tmp', dir=None):
+ def __init__(self, suffix="", prefix="tmp", dir=None):
self.name = _tempfile.mkdtemp(suffix, prefix, dir)
def __repr__(self):
@@ -42,13 +42,14 @@ class _TempDirectory(object):
try:
_shutil.rmtree(self.name)
except (TypeError, AttributeError) as ex:
- if "None" not in '%s' % (ex,):
+ if "None" not in "%s" % (ex,):
raise
self._rmtree(self.name)
self._closed = True
if _warn and _warnings.warn:
- _warnings.warn("Implicitly cleaning up {!r}".format(self),
- ResourceWarning)
+ _warnings.warn(
+ "Implicitly cleaning up {!r}".format(self), ResourceWarning
+ )
def __exit__(self, exc, value, tb):
self.cleanup()
@@ -57,8 +58,15 @@ class _TempDirectory(object):
# Issue a ResourceWarning if implicit cleanup needed
self.cleanup(_warn=True)
- def _rmtree(self, path, _OSError=OSError, _sep=_os.path.sep,
- _listdir=_os.listdir, _remove=_os.remove, _rmdir=_os.rmdir):
+ def _rmtree(
+ self,
+ path,
+ _OSError=OSError,
+ _sep=_os.path.sep,
+ _listdir=_os.listdir,
+ _remove=_os.remove,
+ _rmdir=_os.rmdir,
+ ):
# Essentially a stripped down version of shutil.rmtree. We can't
# use globals because they may be None'ed out at shutdown.
if not isinstance(path, str):