瀏覽代碼

Ensure that directory exists in create_test.py

Hendrik Brucker 8 月之前
父節點
當前提交
16233db6bf
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      tests/create_test.py

+ 3 - 0
tests/create_test.py

@@ -39,6 +39,9 @@ def main():
     name_snake_case = snake_case_regex.sub("_", prefiltered_name).lower()
     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"))
     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)
     print(file_path)
     if os.path.isfile(file_path):
     if os.path.isfile(file_path):
         print(f'ERROR: The file "{file_path}" already exists.')
         print(f'ERROR: The file "{file_path}" already exists.')