Fix TmpDir and Location

TmpDir: Clean up before and after, not just after
Location: Resolve path so that parent check works properly
This commit is contained in:
Joscha 2020-04-23 09:48:09 +00:00
parent 2de4255a78
commit df0eb84a44
2 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ class TmpDir(Location):
"""Create a new temporary folder for the given path.""" """Create a new temporary folder for the given path."""
super().__init__(path) super().__init__(path)
self._counter = 0 self._counter = 0
self.cleanup()
self.path.mkdir(parents=True, exist_ok=True) self.path.mkdir(parents=True, exist_ok=True)
def __str__(self) -> str: def __str__(self) -> str:

View File

@ -88,7 +88,7 @@ class Location:
""" """
def __init__(self, path: Path): def __init__(self, path: Path):
self._path = path self._path = path.resolve()
@property @property
def path(self) -> Path: def path(self) -> Path: