Commits

Anonymous committed 81bb596 Merge

Merge with which_linden tip.

  • Participants
  • Parent commits 0a96f16, b19d029

Comments (0)

Files changed (2)

File 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:

File 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(20000):
                 counter[0]+=1
-                eventlet.sleep(0.001)
+                eventlet.sleep()
                 
         gt = eventlet.spawn(tick)
         previtem = 0
             self.assert_(item >= previtem)
         # make sure the tick happened at least a few times so that we know
         # that our iterations in foo() were actually tpooled
-        self.assert_(counter[0] > 10)
+        self.assert_(counter[0] > 10, counter[0])
         gt.wait()