File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/codemodder/codemods/test Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1414class BaseCodemodTest :
1515 codemod : ClassVar = NotImplemented
1616
17+ @property
18+ def file_extension (self ) -> str :
19+ return "py"
20+
1721 def setup_method (self ):
1822 if isinstance (self .codemod , type ):
1923 self .codemod = self .codemod ()
@@ -30,7 +34,9 @@ def run_and_assert(
3034 lines_to_exclude : list [int ] | None = None ,
3135 ):
3236 root = root or tmpdir
33- tmp_file_path = files [0 ] if files else Path (tmpdir ) / "code.py"
37+ tmp_file_path = (
38+ files [0 ] if files else Path (tmpdir ) / f"code.{ self .file_extension } "
39+ )
3440 tmp_file_path .write_text (dedent (input_code ))
3541
3642 files_to_check = files or [tmp_file_path ]
@@ -142,7 +148,9 @@ def run_and_assert(
142148 results : str = "" ,
143149 ):
144150 root = root or tmpdir
145- tmp_file_path = files [0 ] if files else Path (tmpdir ) / "code.py"
151+ tmp_file_path = (
152+ files [0 ] if files else Path (tmpdir ) / f"code.{ self .file_extension } "
153+ )
146154 tmp_file_path .write_text (dedent (input_code ))
147155
148156 tmp_results_file_path = Path (tmpdir ) / "sast_results"
You can’t perform that action at this time.
0 commit comments