##// END OF EJS Templates
Make separate function to monkeypatch Xunit.
Thomas Kluyver -
Show More
@@ -84,21 +84,17 b" warnings.filterwarnings('ignore', 'wxPython/wxWidgets release number mismatch',"
84 # ------------------------------------------------------------------------------
84 # ------------------------------------------------------------------------------
85 # Monkeypatch Xunit to count known failures as skipped.
85 # Monkeypatch Xunit to count known failures as skipped.
86 # ------------------------------------------------------------------------------
86 # ------------------------------------------------------------------------------
87 if not hasattr(Xunit, 'orig_addError'):
87 def monkeypatch_xunit():
88 try:
88 try:
89 knownfailureif(True)(lambda: None)()
89 knownfailureif(True)(lambda: None)()
90 except Exception as e:
90 except Exception as e:
91 KnownFailureTest = type(e)
91 KnownFailureTest = type(e)
92
92
93
94 def addError(self, test, err, capt=None):
93 def addError(self, test, err, capt=None):
95 if issubclass(err[0], KnownFailureTest):
94 if issubclass(err[0], KnownFailureTest):
96 err = (SkipTest,) + err[1:]
95 err = (SkipTest,) + err[1:]
97 return self.orig_addError(test, err, capt)
96 return self.orig_addError(test, err, capt)
98
97
99 #xunit.Xunit = Xunit
100
101
102 Xunit.orig_addError = Xunit.addError
98 Xunit.orig_addError = Xunit.addError
103 Xunit.addError = addError
99 Xunit.addError = addError
104
100
@@ -410,6 +406,9 b' def run_iptest():'
410 `iptest all`. It simply calls nose with appropriate command line flags
406 `iptest all`. It simply calls nose with appropriate command line flags
411 and accepts all of the standard nose arguments.
407 and accepts all of the standard nose arguments.
412 """
408 """
409 # Apply our monkeypatch to Xunit
410 if not hasattr(Xunit, 'orig_addError'):
411 monkeypatch_xunit()
413
412
414 warnings.filterwarnings('ignore',
413 warnings.filterwarnings('ignore',
415 '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