##// END OF EJS Templates
relax some timing constraints in parallel tests
MinRK -
Show More
@@ -65,7 +65,7 b' def setup():'
65 65 if cp.poll() is not None:
66 66 print cp.poll()
67 67 raise RuntimeError("The test controller failed to start.")
68 elif time.time()-tic > 10:
68 elif time.time()-tic > 15:
69 69 raise RuntimeError("Timeout waiting for the test controller to start.")
70 70 time.sleep(0.1)
71 71 add_engines(1)
@@ -93,7 +93,7 b" def add_engines(n=1, profile='iptest', total=False):"
93 93 while len(rc) < base+n:
94 94 if any([ ep.poll() is not None for ep in eps ]):
95 95 raise RuntimeError("A test engine failed to start.")
96 elif time.time()-tic > 10:
96 elif time.time()-tic > 15:
97 97 raise RuntimeError("Timeout waiting for engines to connect.")
98 98 time.sleep(.1)
99 99 rc.spin()
@@ -154,7 +154,7 b' class AsyncResultTest(ClusterTestCase):'
154 154 ar = v.apply_async(time.sleep, 0.25)
155 155 self.assertRaises(TimeoutError, getattr, ar, 'serial_time')
156 156 ar.get(2)
157 self.assertTrue(ar.serial_time < 0.5)
157 self.assertTrue(ar.serial_time < 1.)
158 158 self.assertTrue(ar.serial_time > 0.2)
159 159
160 160 def test_serial_time_multi(self):
@@ -171,8 +171,8 b' class AsyncResultTest(ClusterTestCase):'
171 171 ar = v.apply_async(time.sleep, 0.25)
172 172 while not ar.ready():
173 173 time.sleep(0.01)
174 self.assertTrue(ar.elapsed < 0.3)
175 self.assertTrue(ar.elapsed < 0.3)
174 self.assertTrue(ar.elapsed < 1)
175 self.assertTrue(ar.elapsed < 1)
176 176 ar.get(2)
177 177
178 178 def test_elapsed_multi(self):
@@ -180,8 +180,8 b' class AsyncResultTest(ClusterTestCase):'
180 180 ar = v.apply_async(time.sleep, 0.25)
181 181 while not ar.ready():
182 182 time.sleep(0.01)
183 self.assertTrue(ar.elapsed < 0.3)
184 self.assertTrue(ar.elapsed < 0.3)
183 self.assertTrue(ar.elapsed < 1)
184 self.assertTrue(ar.elapsed < 1)
185 185 ar.get(2)
186 186
187 187 def test_hubresult_timestamps(self):
@@ -575,13 +575,23 b' class TestView(ClusterTestCase, ParametricTestCase):'
575 575
576 576
577 577 # begin execute tests
578 def _wait_for(self, f, timeout=10):
579 tic = time.time()
580 while time.time() <= tic + timeout:
581 if f():
582 return
583 time.sleep(0.1)
584 self.client.spin()
585 if not f():
586 print "Warning: Awaited condition never arrived"
587
578 588
579 589 def test_execute_reply(self):
580 590 e0 = self.client[self.client.ids[0]]
581 591 e0.block = True
582 592 ar = e0.execute("5", silent=False)
583 593 er = ar.get()
584 time.sleep(0.2)
594 self._wait_for(lambda : bool(er.pyout))
585 595 self.assertEquals(str(er), "<ExecuteReply[%i]: 5>" % er.execution_count)
586 596 self.assertEquals(er.pyout['text/plain'], '5')
587 597
@@ -590,14 +600,15 b' class TestView(ClusterTestCase, ParametricTestCase):'
590 600 e0.block = True
591 601 ar = e0.execute("print (5)", silent=False)
592 602 er = ar.get()
593 time.sleep(0.2)
603 self._wait_for(lambda : bool(er.stdout))
594 604 self.assertEquals(er.stdout.strip(), '5')
595 605
596 606 def test_execute_pyout(self):
597 607 """execute triggers pyout with silent=False"""
598 608 view = self.client[:]
599 609 ar = view.execute("5", silent=False, block=True)
600 time.sleep(0.2)
610 self._wait_for(lambda : all(ar.pyout))
611
601 612 expected = [{'text/plain' : '5'}] * len(view)
602 613 self.assertEquals(ar.pyout, expected)
603 614
@@ -615,7 +626,7 b' class TestView(ClusterTestCase, ParametricTestCase):'
615 626 ar = view.execute("%whos", block=True)
616 627 # this will raise, if that failed
617 628 ar.get(5)
618 time.sleep(0.2)
629 self._wait_for(lambda : all(ar.stdout))
619 630 for stdout in ar.stdout:
620 631 lines = stdout.splitlines()
621 632 self.assertEquals(lines[0].split(), ['Variable', 'Type', 'Data/Info'])
@@ -632,7 +643,8 b' class TestView(ClusterTestCase, ParametricTestCase):'
632 643 view = self.client[:]
633 644 view.execute("from IPython.core.display import *")
634 645 ar = view.execute("[ display(i) for i in range(5) ]", block=True)
635 time.sleep(0.2)
646
647 self._wait_for(lambda : all(len(er.outputs) >= 5 for er in ar))
636 648 outs = [ {u'text/plain' : unicode(i)} for i in range(5) ]
637 649 expected = [outs] * len(view)
638 650 self.assertEquals(ar.outputs, expected)
@@ -648,7 +660,7 b' class TestView(ClusterTestCase, ParametricTestCase):'
648 660
649 661 ar = view.apply_async(publish)
650 662 ar.get(5)
651 time.sleep(0.2)
663 self._wait_for(lambda : all(len(out) >= 5 for out in ar.outputs))
652 664 outs = [ {u'text/plain' : unicode(j)} for j in range(5) ]
653 665 expected = [outs] * len(view)
654 666 self.assertEquals(ar.outputs, expected)
@@ -669,6 +681,7 b' class TestView(ClusterTestCase, ParametricTestCase):'
669 681 # include imports, in case user config
670 682 ar = view.execute("plot(rand(100))", silent=False)
671 683 reply = ar.get(5)
684 self._wait_for(lambda : all(ar.outputs))
672 685 self.assertEquals(len(reply.outputs), 1)
673 686 output = reply.outputs[0]
674 687 self.assertTrue("image/png" in output)
General Comments 0
You need to be logged in to leave comments. Login now