summaryrefslogtreecommitdiffstats
path: root/tests/compat.py
diff options
context:
space:
mode:
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):