Mercurial > hg > orthanc-tests
comparison NewTests/helpers.py @ 593:f4f0e2d24a51
more pg-transactions tests
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 14 Dec 2023 10:41:09 +0100 |
parents | 6753d96dd71f |
children | 3e15e950c462 |
comparison
equal
deleted
inserted
replaced
592:6753d96dd71f | 593:f4f0e2d24a51 |
---|---|
135 return path | 135 return path |
136 | 136 |
137 @classmethod | 137 @classmethod |
138 def clear_storage(cls, storage_name: str): | 138 def clear_storage(cls, storage_name: str): |
139 storage_path = cls.get_storage_path(storage_name=storage_name) | 139 storage_path = cls.get_storage_path(storage_name=storage_name) |
140 shutil.rmtree(storage_path, ignore_errors=True) | 140 |
141 # clear the directory but keep it ! | |
142 for root, dirs, files in os.walk(storage_path): | |
143 for f in files: | |
144 os.unlink(os.path.join(root, f)) | |
145 for d in dirs: | |
146 shutil.rmtree(os.path.join(root, d)) | |
147 shutil.rmtree(storage_path, ignore_errors=True) | |
141 | 148 |
142 @classmethod | 149 @classmethod |
143 def is_storage_empty(cls, storage_name: str): | 150 def is_storage_empty(cls, storage_name: str): |
144 storage_path = cls.get_storage_path(storage_name=storage_name) | 151 storage_path = cls.get_storage_path(storage_name=storage_name) |
145 return len(glob.glob(os.path.join(storage_path, '*'))) == 0 | 152 return len(glob.glob(os.path.join(storage_path, '*'))) == 0 |