##// END OF EJS Templates
Add decorators to mark known failures on Python 3.
Thomas Kluyver -
Show More
@@ -31,6 +31,7 b' except ImportError:'
31 31
32 32 # IPython's own
33 33 from IPython.core import page
34 from IPython.testing.skipdoctest import skip_doctest_py3
34 35 from IPython.utils import PyColorize
35 36 from IPython.utils import io
36 37 from IPython.utils import py3compat
@@ -297,6 +298,8 b' class Inspector:'
297 298 else:
298 299 print >>io.stdout, header,self.format(output),
299 300
301 # In Python 3, all classes are new-style, so they all have __init__.
302 @skip_doctest_py3
300 303 def pdoc(self,obj,oname='',formatter = None):
301 304 """Print the docstring for any object.
302 305
@@ -11,6 +11,7 b' import IPython.testing.tools as tt'
11 11
12 12 from IPython.extensions.autoreload import AutoreloadInterface
13 13 from IPython.core.hooks import TryNext
14 from IPython.testing.decorators import knownfailureif
14 15
15 16 #-----------------------------------------------------------------------------
16 17 # Test fixture
@@ -293,8 +294,12 b' x = -99'
293 294 self.shell.run_code("pass") # trigger reload
294 295 nt.assert_equal(mod.x, -99)
295 296
297 # The autoreload extension needs to be updated for Python 3.2, as .pyc files
298 # are stored in a different location. See gh-846.
299 @knownfailureif(sys.version_info >= (3,2))
296 300 def test_smoketest_aimport(self):
297 301 self._check_smoketest(use_aimport=True)
298 302
303 @knownfailureif(sys.version_info >= (3,2))
299 304 def test_smoketest_autoreload(self):
300 305 self._check_smoketest(use_aimport=False)
@@ -13,6 +13,7 b' import unittest'
13 13
14 14 # IPython imports
15 15 from IPython.lib import irunner
16 from IPython.testing.decorators import known_failure_py3
16 17
17 18 # Testing code begins
18 19 class RunnerTestCase(unittest.TestCase):
@@ -56,6 +57,8 b' class RunnerTestCase(unittest.TestCase):'
56 57 self.assert_(mismatch==0,'Number of mismatched lines: %s' %
57 58 mismatch)
58 59
60 # irunner isn't working on Python 3 (due to pexpect)
61 @known_failure_py3
59 62 def testIPython(self):
60 63 """Test the IPython runner."""
61 64 source = """
@@ -129,6 +132,7 b' In [12]: exit'
129 132 runner = irunner.IPythonRunner(out=self.out)
130 133 self._test_runner(runner,source,output)
131 134
135 @known_failure_py3
132 136 def testPython(self):
133 137 """Test the Python runner."""
134 138 runner = irunner.PythonRunner(out=self.out)
@@ -22,6 +22,7 b' class RunnerTestCase(unittest.TestCase):'
22 22 self.out = StringIO.StringIO()
23 23 #self.out = sys.stdout
24 24
25 @decorators.known_failure_py3
25 26 def _test_runner(self,runner,source,output):
26 27 """Test that a given runner's input/output match."""
27 28
@@ -82,6 +83,7 b' Out\\[6\\]: True'
82 83 runner = irunner.IPythonRunner(out=self.out)
83 84 self._test_runner(runner,source,output)
84 85
86 @decorators.known_failure_py3
85 87 @decorators.skipif_not_matplotlib
86 88 def test_pylab_import_all_disabled(self):
87 89 "Verify that plot is not available when pylab_import_all = False"
@@ -323,6 +323,9 b" skipif_not_sympy = skip_without('sympy')"
323 323
324 324 skip_known_failure = knownfailureif(True,'This test is known to fail')
325 325
326 known_failure_py3 = knownfailureif(sys.version_info[0] >= 3,
327 'This test is known to fail on Python 3.')
328
326 329 # A null 'decorator', useful to make more readable code that needs to pick
327 330 # between different decorators based on OS or other conditions
328 331 null_deco = lambda f: f
@@ -4,6 +4,7 b' The IPython.testing.decorators module triggers various extra imports, including'
4 4 numpy and sympy if they're present. Since this decorator is used in core parts
5 5 of IPython, it's in a separate module so that running IPython doesn't trigger
6 6 those imports."""
7 import sys
7 8
8 9 def skip_doctest(f):
9 10 """Decorator - mark a function or method for skipping its doctest.
@@ -13,3 +14,8 b' def skip_doctest(f):'
13 14 etc."""
14 15 f.skip_doctest = True
15 16 return f
17
18 def skip_doctest_py3(f):
19 """Decorator - skip the doctest under Python 3."""
20 f.skip_doctest = (sys.version_info[0] >= 3)
21 return f
General Comments 0
You need to be logged in to leave comments. Login now