@@ -172,32 +172,6 @@ def test_sleep(self):
172172 with self .subTest (value = value ):
173173 time .sleep (value )
174174
175- @unittest .skipIf (support .MS_WINDOWS , 'test only for non-Windows platforms' )
176- def test_sleep_zero_posix (self ):
177- # Test that time.sleep(0) does not accumulate delays.
178-
179- N1 = 1000 # small number of samples for time.sleep(eps) with eps > 0
180- N2 = 100_000 # large number of samples for time.sleep(0)
181-
182- # Compute how long time.sleep() takes for the 'time' clock resolution.
183- eps = time .get_clock_info ('time' ).resolution
184- max_dt_ns = self .stat_for_test_sleep (N1 , time .sleep , eps )
185-
186- # We expect a gap between time.sleep(0) and time.sleep(eps).
187- avg_dt_ns = self .stat_for_test_sleep (N2 , time .sleep , 0 )
188- self .assertLess (avg_dt_ns , max_dt_ns )
189-
190- @staticmethod
191- def stat_for_test_sleep (n_samples , func , * args , ** kwargs ):
192- """Compute the average (ns) time execution of func(*args, **kwargs)."""
193- samples = []
194- for _ in range (int (n_samples )):
195- t0 = time .monotonic_ns ()
196- func (* args , ** kwargs )
197- t1 = time .monotonic_ns ()
198- samples .append (t1 - t0 )
199- return math .fsum (samples ) / n_samples
200-
201175 def test_epoch (self ):
202176 # bpo-43869: Make sure that Python use the same Epoch on all platforms:
203177 # January 1, 1970, 00:00:00 (UTC).
0 commit comments