##// 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 42 from IPython.testing import nosepatch
43 43 # Now, proceed to import nose itself
44 44 import nose.plugins.builtin
45 from nose.plugins.xunit import Xunit
46 from nose import SkipTest
45 47 from nose.core import TestProgram
46 48
47 49 # Our own imports
@@ -52,7 +54,7 b' from IPython.utils.sysinfo import sys_info'
52 54
53 55 from IPython.testing import globalipapp
54 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 59 pjoin = path.join
58 60
@@ -79,6 +81,23 b" warnings.filterwarnings('ignore', 'the sha module is deprecated',"
79 81 warnings.filterwarnings('ignore', 'wxPython/wxWidgets release number mismatch',
80 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 102 # Logic for skipping doctests
84 103 #-----------------------------------------------------------------------------
@@ -387,6 +406,9 b' def run_iptest():'
387 406 `iptest all`. It simply calls nose with appropriate command line flags
388 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 413 warnings.filterwarnings('ignore',
392 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