Show More
@@ -448,6 +448,7 b' class TestView(ClusterTestCase, ParametricTestCase):' | |||||
448 | ip.magic_autopx() |
|
448 | ip.magic_autopx() | |
449 | ip.run_cell('\n'.join(('a=5','b=10','c=0'))) |
|
449 | ip.run_cell('\n'.join(('a=5','b=10','c=0'))) | |
450 | ip.run_cell('print (b)') |
|
450 | ip.run_cell('print (b)') | |
|
451 | ip.run_cell('import time; time.sleep(0.1)') | |||
451 | ip.run_cell("b/c") |
|
452 | ip.run_cell("b/c") | |
452 | ip.run_cell('b*=2') |
|
453 | ip.run_cell('b*=2') | |
453 | ip.magic_autopx() |
|
454 | ip.magic_autopx() | |
@@ -457,9 +458,12 b' class TestView(ClusterTestCase, ParametricTestCase):' | |||||
457 | self.assertTrue(output.endswith('%autopx disabled')) |
|
458 | self.assertTrue(output.endswith('%autopx disabled')) | |
458 | self.assertFalse('ZeroDivisionError' in output) |
|
459 | self.assertFalse('ZeroDivisionError' in output) | |
459 | ar = v.get_result(-2) |
|
460 | ar = v.get_result(-2) | |
460 | self.assertEquals(v['a'], 5) |
|
|||
461 | self.assertEquals(v['b'], 20) |
|
|||
462 | self.assertRaisesRemote(ZeroDivisionError, ar.get) |
|
461 | self.assertRaisesRemote(ZeroDivisionError, ar.get) | |
|
462 | # prevent TaskAborted on pulls, due to ZeroDivisionError | |||
|
463 | time.sleep(0.5) | |||
|
464 | self.assertEquals(v['a'], 5) | |||
|
465 | # b*=2 will not fire, due to abort | |||
|
466 | self.assertEquals(v['b'], 10) | |||
463 |
|
467 | |||
464 | def test_magic_result(self): |
|
468 | def test_magic_result(self): | |
465 | ip = get_ipython() |
|
469 | ip = get_ipython() | |
@@ -654,4 +658,19 b' class TestView(ClusterTestCase, ParametricTestCase):' | |||||
654 | view = self.client[-1] |
|
658 | view = self.client[-1] | |
655 | ar = view.execute("1/0") |
|
659 | ar = view.execute("1/0") | |
656 | self.assertRaisesRemote(ZeroDivisionError, ar.get, 2) |
|
660 | self.assertRaisesRemote(ZeroDivisionError, ar.get, 2) | |
|
661 | ||||
|
662 | @dec.skipif_not_matplotlib | |||
|
663 | def test_amagic_pylab(self): | |||
|
664 | """%pylab works on engines""" | |||
|
665 | view = self.client[-1] | |||
|
666 | ar = view.execute("%pylab inline") | |||
|
667 | # at least check if this raised: | |||
|
668 | reply = ar.get(5) | |||
|
669 | # include imports, in case user config | |||
|
670 | ar = view.execute("plot(rand(100))", silent=False) | |||
|
671 | reply = ar.get(5) | |||
|
672 | self.assertEquals(len(reply.outputs), 1) | |||
|
673 | output = reply.outputs[0] | |||
|
674 | self.assertTrue("image/png" in output) | |||
|
675 | ||||
657 |
|
676 |
General Comments 0
You need to be logged in to leave comments.
Login now