@@ -1170,28 +1170,19 @@ def _run_once():
11701170 orig_run_once = self .loop ._run_once
11711171 self .loop ._run_once_counter = 0
11721172 self .loop ._run_once = _run_once
1173- calls = []
11741173
11751174 @asyncio .coroutine
11761175 def wait ():
11771176 loop = self .loop
1178- calls .append (loop ._run_once_counter )
1179- yield from asyncio .sleep (loop ._granularity * 10 , loop = loop )
1180- calls .append (loop ._run_once_counter )
1181- yield from asyncio .sleep (loop ._granularity / 10 , loop = loop )
1182- calls .append (loop ._run_once_counter )
1177+ yield from asyncio .sleep (1e-2 , loop = loop )
1178+ yield from asyncio .sleep (1e-4 , loop = loop )
11831179
11841180 self .loop .run_until_complete (wait ())
1185- calls .append (self .loop ._run_once_counter )
1186- self .assertEqual (calls , [1 , 3 , 5 , 6 ])
1187-
1188- def test_granularity (self ):
1189- granularity = self .loop ._granularity
1190- self .assertGreater (granularity , 0.0 )
1191- # Worst expected granularity: 1 ms on Linux (limited by poll/epoll
1192- # resolution), 15.6 ms on Windows (limited by time.monotonic
1193- # resolution)
1194- self .assertLess (granularity , 0.050 )
1181+ # The ideal number of call is 6, but on some platforms, the selector
1182+ # may sleep at little bit less than timeout depending on the resolution
1183+ # of the clock used by the kernel. Tolerate 2 useless calls on these
1184+ # platforms.
1185+ self .assertLessEqual (self .loop ._run_once_counter , 8 )
11951186
11961187
11971188class SubprocessTestsMixin :
0 commit comments