summaryrefslogtreecommitdiff
path: root/test/util.py
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2024-01-11 12:53:34 +0900
committerRyo Nakamura <upa@haeena.net>2024-01-18 12:59:49 +0900
commit5cbf3ad6480adb6615a9a80b59d4a9d1ade62431 (patch)
tree7df444fe7e96dbe11041fe4adf40a615fac6bbed /test/util.py
parent4b34118a88be403e8028806ba09be41212d289b1 (diff)
fix wrong dst path for source path under '/'
When a source file path is /FILE, its dest path would be dst/ILE. This commit fixes this issue (#8).
Diffstat (limited to 'test/util.py')
-rw-r--r--test/util.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/util.py b/test/util.py
index b3b83c5..2baf934 100644
--- a/test/util.py
+++ b/test/util.py
@@ -46,8 +46,10 @@ class File():
with open(self.path, "wb") as f:
f.write(os.urandom(self.size))
- def cleanup(self):
+ def cleanup(self, preserve_dir = False):
os.remove(self.path)
+ if preserve_dir:
+ return
tmp = os.path.dirname(self.path)
while tmp and not tmp in [".", "/"]:
if len(os.listdir(tmp)) == 0: