Browse files

Add decorators to mark known failures on Python 3.

  • Loading branch information...
1 parent 15192a1 commit 21bd93534e6056cdecdb66f27d8b3befa59850c7 @takluyver committed Oct 26, 2011
View
3 IPython/core/oinspect.py
@@ -31,6 +31,7 @@
# IPython's own
from IPython.core import page
+from IPython.testing.skipdoctest import skip_doctest_py3
from IPython.utils import PyColorize
from IPython.utils import io
from IPython.utils import py3compat
@@ -297,6 +298,8 @@ def pdef(self,obj,oname=''):
else:
print >>io.stdout, header,self.format(output),
+ # In Python 3, all classes are new-style, so they all have __init__.
+ @skip_doctest_py3
def pdoc(self,obj,oname='',formatter = None):
"""Print the docstring for any object.
View
5 IPython/extensions/tests/test_autoreload.py
@@ -11,6 +11,7 @@
from IPython.extensions.autoreload import AutoreloadInterface
from IPython.core.hooks import TryNext
+from IPython.testing.decorators import knownfailureif
#-----------------------------------------------------------------------------
# Test fixture
@@ -293,8 +294,12 @@ def check_module_contents():
self.shell.run_code("pass") # trigger reload
nt.assert_equal(mod.x, -99)
+ # The autoreload extension needs to be updated for Python 3.2, as .pyc files
+ # are stored in a different location. See gh-846.
+ @knownfailureif(sys.version_info >= (3,2))
def test_smoketest_aimport(self):
self._check_smoketest(use_aimport=True)
+ @knownfailureif(sys.version_info >= (3,2))
def test_smoketest_autoreload(self):
self._check_smoketest(use_aimport=False)
View
4 IPython/lib/tests/test_irunner.py
@@ -13,6 +13,7 @@
# IPython imports
from IPython.lib import irunner
+from IPython.testing.decorators import known_failure_py3
# Testing code begins
class RunnerTestCase(unittest.TestCase):
@@ -56,6 +57,8 @@ def _test_runner(self,runner,source,output):
self.assert_(mismatch==0,'Number of mismatched lines: %s' %
mismatch)
+ # irunner isn't working on Python 3 (due to pexpect)
+ @known_failure_py3
def testIPython(self):
"""Test the IPython runner."""
source = """
@@ -129,6 +132,7 @@ def testIPython(self):
runner = irunner.IPythonRunner(out=self.out)
self._test_runner(runner,source,output)
+ @known_failure_py3
def testPython(self):
"""Test the Python runner."""
runner = irunner.PythonRunner(out=self.out)
View
2 IPython/lib/tests/test_irunner_pylab_magic.py
@@ -22,6 +22,7 @@ def setUp(self):
self.out = StringIO.StringIO()
#self.out = sys.stdout
+ @decorators.known_failure_py3
def _test_runner(self,runner,source,output):
"""Test that a given runner's input/output match."""
@@ -82,6 +83,7 @@ def test_pylab_import_all_enabled(self):
runner = irunner.IPythonRunner(out=self.out)
self._test_runner(runner,source,output)
+ @decorators.known_failure_py3
@decorators.skipif_not_matplotlib
def test_pylab_import_all_disabled(self):
"Verify that plot is not available when pylab_import_all = False"
View
3 IPython/testing/decorators.py
@@ -323,6 +323,9 @@ def module_not_available(module):
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.')
+
# A null 'decorator', useful to make more readable code that needs to pick
# between different decorators based on OS or other conditions
null_deco = lambda f: f
View
6 IPython/testing/skipdoctest.py
@@ -4,6 +4,7 @@
numpy and sympy if they're present. Since this decorator is used in core parts
of IPython, it's in a separate module so that running IPython doesn't trigger
those imports."""
+import sys
def skip_doctest(f):
"""Decorator - mark a function or method for skipping its doctest.
@@ -13,3 +14,8 @@ def skip_doctest(f):
etc."""
f.skip_doctest = True
return f
+
+def skip_doctest_py3(f):
+ """Decorator - skip the doctest under Python 3."""
+ f.skip_doctest = (sys.version_info[0] >= 3)
+ return f

0 comments on commit 21bd935

Please sign in to comment.