##// END OF EJS Templates
Merge pull request #1395 from takluyver/xunit-kf...
Thomas -
r6111:8096bb86 merge
parent child Browse files
Show More
@@ -42,6 +42,8 b' import warnings'
42 from IPython.testing import nosepatch
42 from IPython.testing import nosepatch
43 # Now, proceed to import nose itself
43 # Now, proceed to import nose itself
44 import nose.plugins.builtin
44 import nose.plugins.builtin
45 from nose.plugins.xunit import Xunit
46 from nose import SkipTest
45 from nose.core import TestProgram
47 from nose.core import TestProgram
46
48
47 # Our own imports
49 # Our own imports
@@ -52,7 +54,7 b' from IPython.utils.sysinfo import sys_info'
52
54
53 from IPython.testing import globalipapp
55 from IPython.testing import globalipapp
54 from IPython.testing.plugin.ipdoctest import IPythonDoctest
56 from IPython.testing.plugin.ipdoctest import IPythonDoctest
55 from IPython.external.decorators import KnownFailure
57 from IPython.external.decorators import KnownFailure, knownfailureif
56
58
57 pjoin = path.join
59 pjoin = path.join
58
60
@@ -79,6 +81,23 b" warnings.filterwarnings('ignore', 'the sha module is deprecated',"
79 warnings.filterwarnings('ignore', 'wxPython/wxWidgets release number mismatch',
81 warnings.filterwarnings('ignore', 'wxPython/wxWidgets release number mismatch',
80 UserWarning)
82 UserWarning)
81
83
84 # ------------------------------------------------------------------------------
85 # Monkeypatch Xunit to count known failures as skipped.
86 # ------------------------------------------------------------------------------
87 def monkeypatch_xunit():
88 try:
89 knownfailureif(True)(lambda: None)()
90 except Exception as e:
91 KnownFailureTest = type(e)
92
93 def addError(self, test, err, capt=None):
94 if issubclass(err[0], KnownFailureTest):
95 err = (SkipTest,) + err[1:]
96 return self.orig_addError(test, err, capt)
97
98 Xunit.orig_addError = Xunit.addError
99 Xunit.addError = addError
100
82 #-----------------------------------------------------------------------------
101 #-----------------------------------------------------------------------------
83 # Logic for skipping doctests
102 # Logic for skipping doctests
84 #-----------------------------------------------------------------------------
103 #-----------------------------------------------------------------------------
@@ -387,6 +406,9 b' def run_iptest():'
387 `iptest all`. It simply calls nose with appropriate command line flags
406 `iptest all`. It simply calls nose with appropriate command line flags
388 and accepts all of the standard nose arguments.
407 and accepts all of the standard nose arguments.
389 """
408 """
409 # Apply our monkeypatch to Xunit
410 if not hasattr(Xunit, 'orig_addError'):
411 monkeypatch_xunit()
390
412
391 warnings.filterwarnings('ignore',
413 warnings.filterwarnings('ignore',
392 'This will be removed soon. Use IPython.testing.util instead')
414 'This will be removed soon. Use IPython.testing.util instead')
General Comments 0
You need to be logged in to leave comments. Login now