Skip to content

Commit 377ebbf

Browse files
pfalconpi-anl
authored andcommitted
unittest: Add expectedFailure decorator.
Signed-off-by: Paul Sokolovsky <[email protected]>
1 parent 8e82f3d commit 377ebbf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

python-stdlib/unittest/unittest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,18 @@ def skipUnless(cond, msg):
199199
return skip(msg)
200200

201201

202+
def expectedFailure(test):
203+
def test_exp_fail(*args, **kwargs):
204+
try:
205+
test(*args, **kwargs)
206+
except:
207+
pass
208+
else:
209+
assert False, "unexpected success"
210+
211+
return test_exp_fail
212+
213+
202214
class TestSuite:
203215
def __init__(self):
204216
self._tests = []

0 commit comments

Comments
 (0)