@@ -220,6 +220,7 @@ def my_show(*args):
220220 m .setattr (MessageDialog , 'ShowModal' , my_show )
221221 robotide ._show_old_wxpython_warning_if_needed ()
222222
223+ @pytest .mark .skipif (sys .platform != 'win32' , reason = "Test only for Windows" )
223224 def test_replace_std_for_win (self ):
224225 import robotide
225226 import sys
@@ -229,6 +230,10 @@ def test_replace_std_for_win(self):
229230 m .setattr (sys , 'stderr' , None )
230231 m .setattr (sys , 'stdout' , None )
231232 robotide ._replace_std_for_win ()
233+ sys .stdout .write ('content' )
234+ sys .stdout .writelines (['content' , 'line two' ])
235+ sys .stdout .flush ()
236+ sys .stdout .close ()
232237
233238
234239class TestMisc (unittest .TestCase ):
@@ -240,7 +245,6 @@ def setUp(self):
240245 self .frame = self .main_app .frame
241246 self .main_app .SetExitOnFrameDelete (True )
242247
243-
244248 def tearDown (self ):
245249 builtins .__import__ = real_import
246250 self .main_app .Destroy ()
@@ -250,6 +254,16 @@ def test_get_code(self):
250254 code = self .main_app ._get_language_code ()
251255 assert code in (175 , wx .LANGUAGE_ENGLISH_WORLD , wx .LANGUAGE_PORTUGUESE )
252256
257+ @pytest .mark .skipif (sys .platform != 'win32' , reason = "Test only for Windows" )
258+ def test_nullstream (self ):
259+ import sys
260+ from robotide import _replace_std_for_win
261+ _replace_std_for_win ()
262+ sys .stdout .write ('content' )
263+ sys .stdout .writelines (['content' , 'line two' ])
264+ sys .stdout .flush ()
265+ sys .stdout .close ()
266+
253267
254268if __name__ == '__main__' :
255269 unittest .main ()
0 commit comments