##// END OF EJS Templates
cleanup
Srinivas Reddy Thatiparthy -
Show More
@@ -8,17 +8,12 b' Needs to be run by nose (to make ipython session available).'
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9
9
10 import sys
10 import sys
11 from io import StringIO
11 from unittest import TestCase
12 from unittest import TestCase
12
13
13 import nose.tools as nt
14 import nose.tools as nt
14
15
15 from IPython.testing import tools as tt
16 from IPython.testing import tools as tt
16 from IPython.utils.py3compat import PY3
17
18 if PY3:
19 from io import StringIO
20 else:
21 from StringIO import StringIO
22
17
23 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
24 # Globals
19 # Globals
@@ -16,7 +16,6 b' from IPython.testing import tools as tt'
16 from IPython.testing.decorators import onlyif_unicode_paths
16 from IPython.testing.decorators import onlyif_unicode_paths
17 from IPython.utils.syspathcontext import prepended_to_syspath
17 from IPython.utils.syspathcontext import prepended_to_syspath
18 from IPython.utils.tempdir import TemporaryDirectory
18 from IPython.utils.tempdir import TemporaryDirectory
19 from IPython.utils.py3compat import PY3
20
19
21 ip = get_ipython()
20 ip = get_ipython()
22
21
@@ -226,20 +225,17 b' except Exception:'
226 """
225 """
227
226
228 def test_direct_cause_error(self):
227 def test_direct_cause_error(self):
229 if PY3:
228 with tt.AssertPrints(["KeyError", "NameError", "direct cause"]):
230 with tt.AssertPrints(["KeyError", "NameError", "direct cause"]):
229 ip.run_cell(self.DIRECT_CAUSE_ERROR_CODE)
231 ip.run_cell(self.DIRECT_CAUSE_ERROR_CODE)
232
230
233 def test_exception_during_handling_error(self):
231 def test_exception_during_handling_error(self):
234 if PY3:
232 with tt.AssertPrints(["KeyError", "NameError", "During handling"]):
235 with tt.AssertPrints(["KeyError", "NameError", "During handling"]):
233 ip.run_cell(self.EXCEPTION_DURING_HANDLING_CODE)
236 ip.run_cell(self.EXCEPTION_DURING_HANDLING_CODE)
237
234
238 def test_suppress_exception_chaining(self):
235 def test_suppress_exception_chaining(self):
239 if PY3:
236 with tt.AssertNotPrints("ZeroDivisionError"), \
240 with tt.AssertNotPrints("ZeroDivisionError"), \
237 tt.AssertPrints("ValueError", suppress=False):
241 tt.AssertPrints("ValueError", suppress=False):
238 ip.run_cell(self.SUPPRESS_CHAINING_CODE)
242 ip.run_cell(self.SUPPRESS_CHAINING_CODE)
243
239
244
240
245 class RecursionTest(unittest.TestCase):
241 class RecursionTest(unittest.TestCase):
General Comments 0
You need to be logged in to leave comments. Login now