diff --git a/IPython/core/tests/test_magic_terminal.py b/IPython/core/tests/test_magic_terminal.py index d204856..a9dd7ac 100644 --- a/IPython/core/tests/test_magic_terminal.py +++ b/IPython/core/tests/test_magic_terminal.py @@ -8,17 +8,12 @@ Needs to be run by nose (to make ipython session available). #----------------------------------------------------------------------------- import sys +from io import StringIO from unittest import TestCase import nose.tools as nt from IPython.testing import tools as tt -from IPython.utils.py3compat import PY3 - -if PY3: - from io import StringIO -else: - from StringIO import StringIO #----------------------------------------------------------------------------- # Globals diff --git a/IPython/core/tests/test_ultratb.py b/IPython/core/tests/test_ultratb.py index f89ebb2..3c91f2d 100644 --- a/IPython/core/tests/test_ultratb.py +++ b/IPython/core/tests/test_ultratb.py @@ -16,7 +16,6 @@ from IPython.testing import tools as tt from IPython.testing.decorators import onlyif_unicode_paths from IPython.utils.syspathcontext import prepended_to_syspath from IPython.utils.tempdir import TemporaryDirectory -from IPython.utils.py3compat import PY3 ip = get_ipython() @@ -226,20 +225,17 @@ except Exception: """ def test_direct_cause_error(self): - if PY3: - with tt.AssertPrints(["KeyError", "NameError", "direct cause"]): - ip.run_cell(self.DIRECT_CAUSE_ERROR_CODE) + with tt.AssertPrints(["KeyError", "NameError", "direct cause"]): + ip.run_cell(self.DIRECT_CAUSE_ERROR_CODE) def test_exception_during_handling_error(self): - if PY3: - with tt.AssertPrints(["KeyError", "NameError", "During handling"]): - ip.run_cell(self.EXCEPTION_DURING_HANDLING_CODE) + with tt.AssertPrints(["KeyError", "NameError", "During handling"]): + ip.run_cell(self.EXCEPTION_DURING_HANDLING_CODE) def test_suppress_exception_chaining(self): - if PY3: - with tt.AssertNotPrints("ZeroDivisionError"), \ - tt.AssertPrints("ValueError", suppress=False): - ip.run_cell(self.SUPPRESS_CHAINING_CODE) + with tt.AssertNotPrints("ZeroDivisionError"), \ + tt.AssertPrints("ValueError", suppress=False): + ip.run_cell(self.SUPPRESS_CHAINING_CODE) class RecursionTest(unittest.TestCase):