Skip to content

Commit

Permalink
Ensure that directory exists in create_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometror committed Dec 28, 2024
1 parent 99a8ab7 commit 16233db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/create_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down

0 comments on commit 16233db

Please sign in to comment.