Skip to content

Commit 067e7ed

Browse files
authored
tmpdir should always be type Path (#716)
1 parent 323a220 commit 067e7ed

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/codemodder/codemods/test/utils.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ def run_and_assert(
6262
files: list[Path] | None = None,
6363
lines_to_exclude: list[int] | None = None,
6464
):
65-
root = root or tmpdir
66-
tmp_file_path = (
67-
files[0] if files else Path(tmpdir) / f"code.{self.file_extension}"
68-
)
65+
root = root or Path(tmpdir)
66+
tmp_file_path = files[0] if files else root / f"code.{self.file_extension}"
6967
tmp_file_path.write_text(dedent(input_code))
7068

7169
files_to_check = files or [tmp_file_path]
@@ -167,13 +165,11 @@ def run_and_assert(
167165
lines_to_exclude: list[int] | None = None,
168166
results: str = "",
169167
):
170-
root = root or tmpdir
171-
tmp_file_path = (
172-
files[0] if files else Path(tmpdir) / f"code.{self.file_extension}"
173-
)
168+
root = root or Path(tmpdir)
169+
tmp_file_path = files[0] if files else root / f"code.{self.file_extension}"
174170
tmp_file_path.write_text(dedent(input_code))
175171

176-
tmp_results_file_path = Path(tmpdir) / "sast_results"
172+
tmp_results_file_path = root / "sast_results"
177173
tmp_results_file_path.write_text(results)
178174

179175
files_to_check = files or [tmp_file_path]

0 commit comments

Comments
 (0)