diff --git a/IPython/core/tests/test_run.py b/IPython/core/tests/test_run.py index e3ade57..e6c20ec 100644 --- a/IPython/core/tests/test_run.py +++ b/IPython/core/tests/test_run.py @@ -19,7 +19,6 @@ import os from os.path import join as pjoin import random import sys -import tempfile import textwrap import unittest @@ -209,7 +208,7 @@ class TestMagicRunPass(tt.TempFileMixin): def test_run_profile( self ): """Test that the option -p, which invokes the profiler, do not crash by invoking execfile""" - _ip = get_ipython() + get_ipython() self.run_tmpfile_p() @@ -368,7 +367,6 @@ tclass.py: deleting object: C-third with tt.AssertNotPrints('SystemExit'): _ip.magic('run -e %s' % self.fname) - @dec.skip_without('nbformat') # Requires jsonschema def test_run_nb(self): """Test %run notebook.ipynb""" from nbformat import v4, writes diff --git a/IPython/core/tests/test_shellapp.py b/IPython/core/tests/test_shellapp.py index 8e15743..8134269 100644 --- a/IPython/core/tests/test_shellapp.py +++ b/IPython/core/tests/test_shellapp.py @@ -19,7 +19,6 @@ import unittest from IPython.testing import decorators as dec from IPython.testing import tools as tt -from IPython.utils.py3compat import PY3 sqlite_err_maybe = dec.module_not_available('sqlite3') SQLITE_NOT_AVAILABLE_ERROR = ('WARNING: IPython History requires SQLite,' @@ -55,14 +54,3 @@ class TestFileToRun(unittest.TestCase, tt.TempFileMixin): out, err = tt.ipexec(self.fname, options=['-i'], commands=['"__file__" in globals()', 'exit()']) self.assertIn("False", out) - - @dec.skip_win32 - @dec.skipif(PY3) - def test_py_script_file_compiler_directive(self): - """Test `__future__` compiler directives with `ipython -i file.py`""" - src = "from __future__ import division\n" - self.mktmp(src) - - out, err = tt.ipexec(self.fname, options=['-i'], - commands=['type(1/2)', 'exit()']) - self.assertIn('float', out) diff --git a/IPython/lib/tests/test_pretty.py b/IPython/lib/tests/test_pretty.py index 6f11e99..4cf8041 100644 --- a/IPython/lib/tests/test_pretty.py +++ b/IPython/lib/tests/test_pretty.py @@ -7,13 +7,13 @@ from __future__ import print_function from collections import Counter, defaultdict, deque, OrderedDict -import types, string, ctypes +import types, string import nose.tools as nt from IPython.lib import pretty -from IPython.testing.decorators import (skip_without, py2_only, py3_only, - cpython2_only) +from IPython.testing.decorators import (skip_without, py2_only, py3_only) + from IPython.utils.py3compat import PY3, unicode_to_str if PY3: @@ -161,7 +161,7 @@ def test_pprint_break_repr(): def test_bad_repr(): """Don't catch bad repr errors""" with nt.assert_raises(ZeroDivisionError): - output = pretty.pretty(BadRepr()) + pretty.pretty(BadRepr()) class BadException(Exception): def __str__(self): @@ -178,7 +178,7 @@ class ReallyBadRepr(object): def test_really_bad_repr(): with nt.assert_raises(BadException): - output = pretty.pretty(ReallyBadRepr()) + pretty.pretty(ReallyBadRepr()) class SA(object): @@ -485,52 +485,3 @@ def test_mappingproxy(): ] for obj, expected in cases: nt.assert_equal(pretty.pretty(obj), expected) - -@cpython2_only # In PyPy, types.DictProxyType is dict -def test_dictproxy(): - # This is the dictproxy constructor itself from the Python API, - DP = ctypes.pythonapi.PyDictProxy_New - DP.argtypes, DP.restype = (ctypes.py_object,), ctypes.py_object - - underlying_dict = {} - mp_recursive = DP(underlying_dict) - underlying_dict[0] = mp_recursive - underlying_dict[-3] = underlying_dict - - cases = [ - (DP({}), "dict_proxy({})"), - (DP({None: DP({})}), "dict_proxy({None: dict_proxy({})})"), - (DP({k: k.lower() for k in string.ascii_uppercase}), - "dict_proxy({'A': 'a',\n" - " 'B': 'b',\n" - " 'C': 'c',\n" - " 'D': 'd',\n" - " 'E': 'e',\n" - " 'F': 'f',\n" - " 'G': 'g',\n" - " 'H': 'h',\n" - " 'I': 'i',\n" - " 'J': 'j',\n" - " 'K': 'k',\n" - " 'L': 'l',\n" - " 'M': 'm',\n" - " 'N': 'n',\n" - " 'O': 'o',\n" - " 'P': 'p',\n" - " 'Q': 'q',\n" - " 'R': 'r',\n" - " 'S': 's',\n" - " 'T': 't',\n" - " 'U': 'u',\n" - " 'V': 'v',\n" - " 'W': 'w',\n" - " 'X': 'x',\n" - " 'Y': 'y',\n" - " 'Z': 'z'})"), - (mp_recursive, "dict_proxy({-3: {-3: {...}, 0: {...}}, 0: {...}})"), - ] - for obj, expected in cases: - nt.assert_is_instance(obj, types.DictProxyType) # Meta-test - nt.assert_equal(pretty.pretty(obj), expected) - nt.assert_equal(pretty.pretty(underlying_dict), - "{-3: {...}, 0: dict_proxy({-3: {...}, 0: {...}})}") diff --git a/IPython/testing/decorators.py b/IPython/testing/decorators.py index 087555d..f31af91 100644 --- a/IPython/testing/decorators.py +++ b/IPython/testing/decorators.py @@ -336,7 +336,6 @@ skip_known_failure = knownfailureif(True,'This test is known to fail') known_failure_py3 = knownfailureif(sys.version_info[0] >= 3, 'This test is known to fail on Python 3.') -cpython2_only = skipif(PY3 or PYPY, "This test only runs on CPython 2.") py2_only = skipif(PY3, "This test only runs on Python 2.") py3_only = skipif(PY2, "This test only runs on Python 3.")