Skip to content

Commit feb1ef3

Browse files
committed
enable file path to be used
1 parent 8aa5b58 commit feb1ef3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def _create_files(files: Set[Tuple[FileTypes, str]]):
6969
if not isinstance(file_type, FileTypes):
7070
raise ValueError(f"Invalid file type: {file_type}")
7171
write_file_name = tmp_path / Path(file_name)
72+
# create the subfolder (if file name is a path with folders)
73+
write_file_name.parent.mkdir(parents=True, exist_ok=True)
7274

7375
read_file_path = Path("tests/data")
7476
read_file_name: Path = None
@@ -96,8 +98,8 @@ def _create_files(files: Set[Tuple[FileTypes, str]]):
9698

9799
with open(read_file_name, "r") as f:
98100
content = f.read()
99-
with open(write_file_name, "w+") as f2:
100-
f2.write(content)
101+
with open(write_file_name, "w+") as f:
102+
f.write(content)
101103

102104
return tmp_path
103105

0 commit comments

Comments
 (0)