From 3fb37a1d0237869e8e37864d06c0dfd94bb43189 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 Sep 2021 06:12:56 +0200 Subject: Merging upstream version 2.2.0. Signed-off-by: Daniel Baumann --- tests/compat.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'tests/compat.py') 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): -- cgit v1.2.3