##// END OF EJS Templates
Merge pull request #2305 from minrk/render_traceback...
Min RK -
r8296:58335ad7 merge
parent child Browse files
Show More
@@ -194,9 +194,15 b' class RemoteError(KernelError):'
194 """render traceback to a list of lines"""
194 """render traceback to a list of lines"""
195 return (self.traceback or "No traceback available").splitlines()
195 return (self.traceback or "No traceback available").splitlines()
196
196
197 # Special method for custom tracebacks within IPython
197 def _render_traceback_(self):
198 _render_traceback_ = render_traceback
198 """Special method for custom tracebacks within IPython.
199
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()
205
200 def print_traceback(self, excid=None):
206 def print_traceback(self, excid=None):
201 """print my traceback"""
207 """print my traceback"""
202 print('\n'.join(self.render_traceback()))
208 print('\n'.join(self.render_traceback()))
@@ -27,6 +27,7 b' from nose import SkipTest'
27
27
28 from IPython.testing import decorators as dec
28 from IPython.testing import decorators as dec
29 from IPython.testing.ipunittest import ParametricTestCase
29 from IPython.testing.ipunittest import ParametricTestCase
30 from IPython.utils.io import capture_output
30
31
31 from IPython import parallel as pmod
32 from IPython import parallel as pmod
32 from IPython.parallel import error
33 from IPython.parallel import error
@@ -578,6 +579,30 b' class TestView(ClusterTestCase, ParametricTestCase):'
578 ar = view.execute("1/0")
579 ar = view.execute("1/0")
579 self.assertRaisesRemote(ZeroDivisionError, ar.get, 2)
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 @dec.skipif_not_matplotlib
606 @dec.skipif_not_matplotlib
582 def test_magic_pylab(self):
607 def test_magic_pylab(self):
583 """%pylab works on engines"""
608 """%pylab works on engines"""
General Comments 0
You need to be logged in to leave comments. Login now