##// END OF EJS Templates
make spin_thread tests more forgiving of slow VMs...
MinRK -
Show More
@@ -522,19 +522,23 b' class TestClient(ClusterTestCase):'
522 def test_spin_thread(self):
522 def test_spin_thread(self):
523 self.client.spin_thread(0.01)
523 self.client.spin_thread(0.01)
524 ar = self.client[-1].apply_async(lambda : 1)
524 ar = self.client[-1].apply_async(lambda : 1)
525 time.sleep(0.1)
525 md = self.client.metadata[ar.msg_ids[0]]
526 self.assertTrue(ar.wall_time < 0.1,
526 # 3s timeout, 100ms poll
527 "spin should have kept wall_time < 0.1, but got %f" % ar.wall_time
527 for i in range(30):
528 )
528 time.sleep(0.1)
529 if md['received'] is not None:
530 break
531 self.assertIsInstance(md['received'], datetime)
529
532
530 def test_stop_spin_thread(self):
533 def test_stop_spin_thread(self):
531 self.client.spin_thread(0.01)
534 self.client.spin_thread(0.01)
532 self.client.stop_spin_thread()
535 self.client.stop_spin_thread()
533 ar = self.client[-1].apply_async(lambda : 1)
536 ar = self.client[-1].apply_async(lambda : 1)
534 time.sleep(0.15)
537 md = self.client.metadata[ar.msg_ids[0]]
535 self.assertTrue(ar.wall_time > 0.1,
538 # 500ms timeout, 100ms poll
536 "Shouldn't be spinning, but got wall_time=%f" % ar.wall_time
539 for i in range(5):
537 )
540 time.sleep(0.1)
541 self.assertIsNone(md['received'], None)
538
542
539 def test_activate(self):
543 def test_activate(self):
540 ip = get_ipython()
544 ip = get_ipython()
General Comments 0
You need to be logged in to leave comments. Login now