@@ -881,6 +881,7 @@ def test_logs_streaming_and_follow(self):
881
881
882
882
assert logs == (snippet + '\n ' ).encode (encoding = 'ascii' )
883
883
884
+ @pytest .mark .timeout (5 )
884
885
def test_logs_streaming_and_follow_and_cancel (self ):
885
886
snippet = 'Flowering Nights (Sakuya Iyazoi)'
886
887
container = self .client .create_container (
@@ -892,17 +893,11 @@ def test_logs_streaming_and_follow_and_cancel(self):
892
893
logs = six .binary_type ()
893
894
894
895
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
-
899
896
threading .Timer (1 , generator .close ).start ()
900
897
901
898
for chunk in generator :
902
899
logs += chunk
903
900
904
- exit_timer .cancel ()
905
-
906
901
assert logs == (snippet + '\n ' ).encode (encoding = 'ascii' )
907
902
908
903
def test_logs_with_dict_instead_of_id (self ):
@@ -1251,6 +1246,7 @@ def test_attach_no_stream(self):
1251
1246
output = self .client .attach (container , stream = False , logs = True )
1252
1247
assert output == 'hello\n ' .encode (encoding = 'ascii' )
1253
1248
1249
+ @pytest .mark .timeout (5 )
1254
1250
def test_attach_stream_and_cancel (self ):
1255
1251
container = self .client .create_container (
1256
1252
BUSYBOX , 'sh -c "echo hello && sleep 60"' ,
@@ -1260,17 +1256,12 @@ def test_attach_stream_and_cancel(self):
1260
1256
self .client .start (container )
1261
1257
output = self .client .attach (container , stream = True , logs = True )
1262
1258
1263
- exit_timer = threading .Timer (3 , os ._exit , args = [1 ])
1264
- exit_timer .start ()
1265
-
1266
1259
threading .Timer (1 , output .close ).start ()
1267
1260
1268
1261
lines = []
1269
1262
for line in output :
1270
1263
lines .append (line )
1271
1264
1272
- exit_timer .cancel ()
1273
-
1274
1265
assert len (lines ) == 1
1275
1266
assert lines [0 ] == 'hello\r \n ' .encode (encoding = 'ascii' )
1276
1267
0 commit comments