@@ -116,23 +116,22 @@ def test_source_is_formatted(self, filename: str) -> None:
116116 def check_file (self , filename : str , mode : black .Mode , kwargs : dict , * , data : bool = True ) -> None :
117117 source , expected = read_data (filename , data = data )
118118
119- result : Result
120-
121119 with TemporaryPathPlus () as tmp_pathplus :
122- (tmp_pathplus / filename ).write_text (source )
120+ python_file = (tmp_pathplus / filename ).with_suffix (".py" )
121+ python_file .write_text (source )
123122 toml_data = dom_toml .load (PathPlus (__file__ ).parent / "example_formate.toml" )
124123 toml_data ["hooks" ]["black" ]["kwargs" ] = kwargs
125124 dom_toml .dump (toml_data , tmp_pathplus / "formate.toml" )
126125
127126 with in_directory (tmp_pathplus ):
128127 runner = CliRunner (mix_stderr = False )
129- result = runner .invoke (
128+ result : Result = runner .invoke (
130129 main ,
131- args = [filename , "--no-colour" , "--diff" , "--verbose" , "-v" ],
130+ args = [python_file . name , "--no-colour" , "--diff" , "--verbose" , "-v" ],
132131 )
133132
134133 # TODO: check stdout
135- actual = ( tmp_pathplus / filename ) .read_text ()
134+ actual = python_file .read_text ()
136135
137136 self .assertFormatEqual (expected , actual )
138137 if source != actual :
0 commit comments