File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 27
27
import socket
28
28
import time
29
29
import unittest
30
+ from test import support
30
31
31
32
if not hasattr (select , "epoll" ):
32
33
raise unittest .SkipTest ("test works only on Linux 2.6" )
@@ -186,10 +187,16 @@ def test_control_and_wait(self):
186
187
client .sendall (b"Hello!" )
187
188
server .sendall (b"world!!!" )
188
189
189
- now = time .monotonic ()
190
- events = ep .poll (1.0 , 4 )
191
- then = time .monotonic ()
192
- self .assertFalse (then - now > 0.01 )
190
+ # we might receive events one at a time, necessitating multiple calls to
191
+ # poll
192
+ events = []
193
+ for _ in support .busy_retry (support .SHORT_TIMEOUT ):
194
+ now = time .monotonic ()
195
+ events += ep .poll (1.0 , 4 )
196
+ then = time .monotonic ()
197
+ self .assertFalse (then - now > 0.01 )
198
+ if len (events ) >= 2 :
199
+ break
193
200
194
201
expected = [(client .fileno (), select .EPOLLIN | select .EPOLLOUT ),
195
202
(server .fileno (), select .EPOLLIN | select .EPOLLOUT )]
You can’t perform that action at this time.
0 commit comments