Show More
@@ -194,8 +194,14 class RemoteError(KernelError): | |||
|
194 | 194 | """render traceback to a list of lines""" |
|
195 | 195 | return (self.traceback or "No traceback available").splitlines() |
|
196 | 196 | |
|
197 | # Special method for custom tracebacks within IPython | |
|
198 | _render_traceback_ = render_traceback | |
|
197 | def _render_traceback_(self): | |
|
198 | """Special method for custom tracebacks within IPython. | |
|
199 | ||
|
200 | This will be called by IPython instead of displaying the local traceback. | |
|
201 | ||
|
202 | It should return a traceback rendered as a list of lines. | |
|
203 | """ | |
|
204 | return self.render_traceback() | |
|
199 | 205 | |
|
200 | 206 | def print_traceback(self, excid=None): |
|
201 | 207 | """print my traceback""" |
@@ -27,6 +27,7 from nose import SkipTest | |||
|
27 | 27 | |
|
28 | 28 | from IPython.testing import decorators as dec |
|
29 | 29 | from IPython.testing.ipunittest import ParametricTestCase |
|
30 | from IPython.utils.io import capture_output | |
|
30 | 31 | |
|
31 | 32 | from IPython import parallel as pmod |
|
32 | 33 | from IPython.parallel import error |
@@ -578,6 +579,30 class TestView(ClusterTestCase, ParametricTestCase): | |||
|
578 | 579 | ar = view.execute("1/0") |
|
579 | 580 | self.assertRaisesRemote(ZeroDivisionError, ar.get, 2) |
|
580 | 581 | |
|
582 | def test_remoteerror_render_exception(self): | |
|
583 | """RemoteErrors get nice tracebacks""" | |
|
584 | view = self.client[-1] | |
|
585 | ar = view.execute("1/0") | |
|
586 | ip = get_ipython() | |
|
587 | ip.user_ns['ar'] = ar | |
|
588 | with capture_output() as io: | |
|
589 | ip.run_cell("ar.get(2)") | |
|
590 | ||
|
591 | self.assertTrue('ZeroDivisionError' in io.stdout, io.stdout) | |
|
592 | ||
|
593 | def test_compositeerror_render_exception(self): | |
|
594 | """CompositeErrors get nice tracebacks""" | |
|
595 | view = self.client[:] | |
|
596 | ar = view.execute("1/0") | |
|
597 | ip = get_ipython() | |
|
598 | ip.user_ns['ar'] = ar | |
|
599 | with capture_output() as io: | |
|
600 | ip.run_cell("ar.get(2)") | |
|
601 | ||
|
602 | self.assertEqual(io.stdout.count('ZeroDivisionError'), len(view) * 2, io.stdout) | |
|
603 | self.assertEqual(io.stdout.count('integer division'), len(view), io.stdout) | |
|
604 | self.assertEqual(io.stdout.count(':execute'), len(view), io.stdout) | |
|
605 | ||
|
581 | 606 | @dec.skipif_not_matplotlib |
|
582 | 607 | def test_magic_pylab(self): |
|
583 | 608 | """%pylab works on engines""" |
General Comments 0
You need to be logged in to leave comments.
Login now