@@ -137,19 +137,19 @@ def make_file(self, base: str, path: str) -> None:
137137
138138
139139class DaemonWatchSuite (unittest .TestCase ):
140- def setUp (self ):
140+ def setUp (self ) -> None :
141141 self .temp_dir = tempfile .TemporaryDirectory ()
142142 self .temp_path = pathlib .Path (self .temp_dir .name )
143143 self .output_lines = []
144144 self .stop_reader = False
145145
146- def _read_output (self ):
146+ def _read_output (self ) -> None :
147147 for line in self .process .stdout :
148148 self .output_lines .append (line .strip ())
149149 if self .stop_reader :
150150 break
151151
152- def _start_watching (self , args : str , start_daemon : bool = True ):
152+ def _start_watching (self , args : str , start_daemon : bool = True ) -> None :
153153 if start_daemon :
154154 subprocess .run (
155155 [sys .executable , "-m" , "mypy.dmypy" , "start" ],
@@ -172,7 +172,7 @@ def _start_watching(self, args: str, start_daemon: bool = True):
172172 self .reader_thread = threading .Thread (target = self ._read_output , daemon = True )
173173 self .reader_thread .start ()
174174
175- def _wait_for_output (self , text : str , timeout = 5 ) :
175+ def _wait_for_output (self , text : str , timeout : int = 5 ) -> bool :
176176 """Wait for text to appear in output within timeout seconds."""
177177 start_time = time .time ()
178178 while time .time () - start_time < timeout :
@@ -181,7 +181,7 @@ def _wait_for_output(self, text: str, timeout=5):
181181 time .sleep (0.1 )
182182 return False
183183
184- def test_watcher_reacts_to_file_changes (self ):
184+ def test_watcher_reacts_to_file_changes (self ) -> None :
185185 (self .temp_path / "valid.py" ).write_text (
186186 "def hello_world() -> str:\n return 'Hello World!'"
187187 )
@@ -198,7 +198,7 @@ def test_watcher_reacts_to_file_changes(self):
198198 self .assertTrue (self ._wait_for_output ("Incompatible return value type" ))
199199 self .assertTrue (self ._wait_for_output ("Found 1 error in 1 file" ))
200200
201- def tearDown (self ):
201+ def tearDown (self ) -> None :
202202 print (self .output_lines )
203203 subprocess .run ([sys .executable , "-m" , "mypy.dmypy" , "stop" ], cwd = self .temp_path )
204204
0 commit comments