File tree Expand file tree Collapse file tree
IPython/external/decorators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,9 +133,16 @@ def knownfail_decorator(f):
133133 # import time overhead at actual test-time.
134134 import nose
135135
136+ try :
137+ from pytest import xfail
138+ except ImportError :
139+
140+ def xfail ():
141+ raise KnownFailureTest (msg )
142+
136143 def knownfailer (* args , ** kwargs ):
137144 if fail_condition :
138- raise KnownFailureTest (msg )
145+ xfail (msg )
139146 else :
140147 return f (* args , ** kwargs )
141148 return nose .tools .make_decorator (f )(knownfailer )
Original file line number Diff line number Diff line change 77
88from nose .plugins .errorclass import ErrorClass , ErrorClassPlugin
99
10- class KnownFailureTest (Exception ):
11- '''Raise this exception to mark a test as a known failing test.'''
12- pass
10+
11+ try :
12+ import pytest
13+
14+ KnownFailureTest = pytest .xfail .Exception
15+ except ImportError :
16+
17+ class KnownFailureTest (Exception ):
18+ """Raise this exception to mark a test as a known failing test."""
1319
1420
1521class KnownFailure (ErrorClassPlugin ):
You can’t perform that action at this time.
0 commit comments