diff 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
line wrap: on
line diff
--- a/NewTests/helpers.py	Tue Dec 12 15:31:45 2023 +0100
+++ b/NewTests/helpers.py	Thu Dec 14 10:41:09 2023 +0100
@@ -137,7 +137,14 @@
     @classmethod
     def clear_storage(cls, storage_name: str):
         storage_path = cls.get_storage_path(storage_name=storage_name)
-        shutil.rmtree(storage_path, ignore_errors=True)
+
+        # clear the directory but keep it !
+        for root, dirs, files in os.walk(storage_path):
+            for f in files:
+                os.unlink(os.path.join(root, f))
+            for d in dirs:
+                shutil.rmtree(os.path.join(root, d))
+                shutil.rmtree(storage_path, ignore_errors=True)
 
     @classmethod
     def is_storage_empty(cls, storage_name: str):