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