summaryrefslogtreecommitdiffstats
path: root/tests/compat.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:12:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:13:23 +0000
commit3fb37a1d0237869e8e37864d06c0dfd94bb43189 (patch)
treeda8700e80772bd4c9605f263a3299a54d96f636b /tests/compat.py
parentReleasing debian version 2.1.0-2. (diff)
downloadcli-helpers-3fb37a1d0237869e8e37864d06c0dfd94bb43189.tar.xz
cli-helpers-3fb37a1d0237869e8e37864d06c0dfd94bb43189.zip
Merging upstream version 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):