commit 1935dc625b28540cc8f20ac670fc86313f8b3daf
parent b59efeeb55c6fe7af0d1adf77e01bae0d933c32e
Author: Antoine A <>
Date: Wed, 2 Oct 2024 13:22:57 +0200
testbench: improve script
Diffstat:
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/testbench/clean_test_logs.py b/testbench/clean_test_logs.py
@@ -10,12 +10,13 @@ DIR = Path("test")
def rmtree(p: Path):
"""Recursively delete file or directory"""
- if p.is_file():
- p.unlink()
- else:
- for child in p.iterdir():
- rmtree(child)
- p.rmdir()
+ if p.exists():
+ if p.is_dir():
+ for child in p.iterdir():
+ rmtree(child)
+ p.rmdir()
+ else:
+ p.unlink()
def remove(p: Path, reason: str):
@@ -53,11 +54,10 @@ for platform in DIR.iterdir():
content = payload_file_path.read_text()
if "HAC" in request.name and "ORDER_HAC_FINAL_NEG" not in content:
remove(request, "simple hac")
- continue
elif "HAA" in request.name and "<Service>" not in content:
remove(request, "empty haa")
- continue
- rm_if_similar(payload_file_path, content)
+ else:
+ rm_if_similar(payload_file_path, content)
elif payload_dir_path.exists():
for file in payload_dir_path.iterdir():
content = file.read_text()