Skip to content

Commit

Permalink
remove temporary directories during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Aug 4, 2019
1 parent fdf8594 commit c6b71b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/tempfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def clean(self):
except Exception as error:
if not self._ignore_clean_errors:
raise errors.OperationFailed(
msg="failed to remove temporary directory", exc=error
msg="failed to remove temporary directory; {}".format(error),
exc=error,
)
self._cleaned = True
5 changes: 5 additions & 0 deletions tests/test_osfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def make_fs(self):

def destroy_fs(self, fs):
self.fs.close()
try:
shutil.rmtree(fs.getsyspath("/"))
except OSError:
# Already deleted
pass

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

0 comments on commit c6b71b7

Please sign in to comment.