File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 2727import socket
2828import time
2929import unittest
30+ from test import support
3031
3132if not hasattr (select , "epoll" ):
3233 raise unittest .SkipTest ("test works only on Linux 2.6" )
@@ -186,10 +187,16 @@ def test_control_and_wait(self):
186187 client .sendall (b"Hello!" )
187188 server .sendall (b"world!!!" )
188189
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
193200
194201 expected = [(client .fileno (), select .EPOLLIN | select .EPOLLOUT ),
195202 (server .fileno (), select .EPOLLIN | select .EPOLLOUT )]
You can’t perform that action at this time.
0 commit comments