diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_e2e.py | 2 | ||||
-rw-r--r-- | test/util.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/test/test_e2e.py b/test/test_e2e.py index b6ed73d..a73d896 100644 --- a/test/test_e2e.py +++ b/test/test_e2e.py @@ -216,7 +216,7 @@ def test_copy_file_under_root_to_dir(mscp, src_prefix, dst_prefix): dst_prefix + os.path.dirname(dst.path)]) assert check_same_md5sum(src, dst) src.cleanup() - dst.cleanup() + dst.cleanup(preserve_dir = True) @pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix) 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: |