diff options
Diffstat (limited to 'libbe/utility.py')
-rw-r--r-- | libbe/utility.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libbe/utility.py b/libbe/utility.py index 972fe47..f156ce9 100644 --- a/libbe/utility.py +++ b/libbe/utility.py @@ -97,12 +97,15 @@ def search_parent_directories(path, filename): old_path = path path = os.path.dirname(path) -class Dir: +class Dir (object): "A temporary directory for testing use" def __init__(self): self.path = tempfile.mkdtemp(prefix="BEtest") self.shutil = shutil # save local reference for __del__ def __del__(self): + self.cleanup() + def cleanup(self): + print "Removing", self.path self.shutil.rmtree(self.path) def __call__(self): return self.path |