Show More
@@ -133,9 +133,16 b' def knownfailureif(fail_condition, msg=None):' | |||||
133 | # import time overhead at actual test-time. |
|
133 | # import time overhead at actual test-time. | |
134 | import nose |
|
134 | import nose | |
135 |
|
135 | |||
|
136 | try: | |||
|
137 | from pytest import xfail | |||
|
138 | except ImportError: | |||
|
139 | ||||
|
140 | def xfail(): | |||
|
141 | raise KnownFailureTest(msg) | |||
|
142 | ||||
136 | def knownfailer(*args, **kwargs): |
|
143 | def knownfailer(*args, **kwargs): | |
137 | if fail_condition: |
|
144 | if fail_condition: | |
138 |
|
|
145 | xfail(msg) | |
139 | else: |
|
146 | else: | |
140 | return f(*args, **kwargs) |
|
147 | return f(*args, **kwargs) | |
141 | return nose.tools.make_decorator(f)(knownfailer) |
|
148 | return nose.tools.make_decorator(f)(knownfailer) |
@@ -7,9 +7,15 b' import os' | |||||
7 |
|
7 | |||
8 | from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin |
|
8 | from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin | |
9 |
|
9 | |||
10 | class KnownFailureTest(Exception): |
|
10 | ||
11 | '''Raise this exception to mark a test as a known failing test.''' |
|
11 | try: | |
12 | pass |
|
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.""" | |||
13 |
|
19 | |||
14 |
|
20 | |||
15 | class KnownFailure(ErrorClassPlugin): |
|
21 | class KnownFailure(ErrorClassPlugin): |
General Comments 0
You need to be logged in to leave comments.
Login now