##// END OF EJS Templates
Monkeypatch Xunit to count known failures as skips, not errors.
Thomas Kluyver -
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,27 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 if not hasattr(Xunit, 'orig_addError'):
88 try:
89 knownfailureif(True)(lambda: None)()
90 except Exception as e:
91 KnownFailureTest = type(e)
92
93
94 def addError(self, test, err, capt=None):
95 if issubclass(err[0], KnownFailureTest):
96 err = (SkipTest,) + err[1:]
97 return self.orig_addError(test, err, capt)
98
99 #xunit.Xunit = Xunit
100
101
102 Xunit.orig_addError = Xunit.addError
103 Xunit.addError = addError
104
82 #-----------------------------------------------------------------------------
105 #-----------------------------------------------------------------------------
83 # Logic for skipping doctests
106 # Logic for skipping doctests
84 #-----------------------------------------------------------------------------
107 #-----------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now