Commits

Ryan Williams committed 7d444cc

Fixed overlong duration of iterator test.

Comments (0)

Files changed (2)

tests/__init__.py

         self.timer = eventlet.Timeout(self.TEST_TIMEOUT, 
                                       TestIsTakingTooLong(self.TEST_TIMEOUT))
 
+    def reset_timeout(self, new_timeout):
+        """Changes the timeout duration; only has effect during one test case"""
+        import eventlet
+        self.timer.cancel()
+        self.timer = eventlet.Timeout(new_timeout, 
+                                      TestIsTakingTooLong(new_timeout))
+
     def tearDown(self):
         self.timer.cancel()
         try:

tests/tpool_test.py

         
     @skip_with_pyevent
     def test_wrap_iterator2(self):
+        self.reset_timeout(5)  # might take a while due to imprecise sleeping
         def foo():
             import time
-            for x in xrange(10):
+            for x in xrange(2):
                 yield x
-                time.sleep(0.01)
+                time.sleep(0.001)
                 
         counter = [0]
         def tick():
-            for i in xrange(100):
+            for i in xrange(20):
                 counter[0]+=1
-                eventlet.sleep(0.001)
+                eventlet.sleep(0.0001)
                 
         gt = eventlet.spawn(tick)
         previtem = 0