From 16233db6bf3bf7afc368cd179700e1ecce1baed3 Mon Sep 17 00:00:00 2001 From: Hendrik Brucker Date: Sat, 28 Dec 2024 01:38:59 +0100 Subject: [PATCH] Ensure that directory exists in create_test.py --- tests/create_test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/create_test.py b/tests/create_test.py index ad6d6b882fc..9181cb3ac84 100755 --- a/tests/create_test.py +++ b/tests/create_test.py @@ -39,6 +39,9 @@ def main(): name_snake_case = snake_case_regex.sub("_", prefiltered_name).lower() file_path = os.path.normpath(os.path.join(args.path, f"test_{name_snake_case}.h")) + # Ensure the directory exists. + os.makedirs(os.path.dirname(file_path), exist_ok=True) + print(file_path) if os.path.isfile(file_path): print(f'ERROR: The file "{file_path}" already exists.')