From df0eb84a44daa50cdf93fb608e4bfe1e897787a2 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 23 Apr 2020 09:48:09 +0000 Subject: [PATCH] Fix TmpDir and Location TmpDir: Clean up before and after, not just after Location: Resolve path so that parent check works properly --- PFERD/tmp_dir.py | 1 + PFERD/utils.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PFERD/tmp_dir.py b/PFERD/tmp_dir.py index 850d886..fc132b8 100644 --- a/PFERD/tmp_dir.py +++ b/PFERD/tmp_dir.py @@ -18,6 +18,7 @@ class TmpDir(Location): """Create a new temporary folder for the given path.""" super().__init__(path) self._counter = 0 + self.cleanup() self.path.mkdir(parents=True, exist_ok=True) def __str__(self) -> str: diff --git a/PFERD/utils.py b/PFERD/utils.py index e2b69be..7b8e86c 100644 --- a/PFERD/utils.py +++ b/PFERD/utils.py @@ -88,7 +88,7 @@ class Location: """ def __init__(self, path: Path): - self._path = path + self._path = path.resolve() @property def path(self) -> Path: