Skip to content

Commit c6b71b7

Browse files
committed
remove temporary directories during tests
1 parent fdf8594 commit c6b71b7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fs/tempfs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def clean(self):
8686
except Exception as error:
8787
if not self._ignore_clean_errors:
8888
raise errors.OperationFailed(
89-
msg="failed to remove temporary directory", exc=error
89+
msg="failed to remove temporary directory; {}".format(error),
90+
exc=error,
9091
)
9192
self._cleaned = True

tests/test_osfs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def make_fs(self):
2828

2929
def destroy_fs(self, fs):
3030
self.fs.close()
31+
try:
32+
shutil.rmtree(fs.getsyspath("/"))
33+
except OSError:
34+
# Already deleted
35+
pass
3136

3237
def _get_real_path(self, path):
3338
_path = os.path.join(self.fs.root_path, relpath(path))

0 commit comments

Comments
 (0)