@@ -881,6 +881,7 @@ def test_logs_streaming_and_follow(self):
881881
882882 assert logs == (snippet + '\n ' ).encode (encoding = 'ascii' )
883883
884+ @pytest .mark .timeout (5 )
884885 def test_logs_streaming_and_follow_and_cancel (self ):
885886 snippet = 'Flowering Nights (Sakuya Iyazoi)'
886887 container = self .client .create_container (
@@ -892,17 +893,11 @@ def test_logs_streaming_and_follow_and_cancel(self):
892893 logs = six .binary_type ()
893894
894895 generator = self .client .logs (id , stream = True , follow = True )
895-
896- exit_timer = threading .Timer (3 , os ._exit , args = [1 ])
897- exit_timer .start ()
898-
899896 threading .Timer (1 , generator .close ).start ()
900897
901898 for chunk in generator :
902899 logs += chunk
903900
904- exit_timer .cancel ()
905-
906901 assert logs == (snippet + '\n ' ).encode (encoding = 'ascii' )
907902
908903 def test_logs_with_dict_instead_of_id (self ):
@@ -1251,6 +1246,7 @@ def test_attach_no_stream(self):
12511246 output = self .client .attach (container , stream = False , logs = True )
12521247 assert output == 'hello\n ' .encode (encoding = 'ascii' )
12531248
1249+ @pytest .mark .timeout (5 )
12541250 def test_attach_stream_and_cancel (self ):
12551251 container = self .client .create_container (
12561252 BUSYBOX , 'sh -c "echo hello && sleep 60"' ,
@@ -1260,17 +1256,12 @@ def test_attach_stream_and_cancel(self):
12601256 self .client .start (container )
12611257 output = self .client .attach (container , stream = True , logs = True )
12621258
1263- exit_timer = threading .Timer (3 , os ._exit , args = [1 ])
1264- exit_timer .start ()
1265-
12661259 threading .Timer (1 , output .close ).start ()
12671260
12681261 lines = []
12691262 for line in output :
12701263 lines .append (line )
12711264
1272- exit_timer .cancel ()
1273-
12741265 assert len (lines ) == 1
12751266 assert lines [0 ] == 'hello\r \n ' .encode (encoding = 'ascii' )
12761267
0 commit comments