Skip to content

Commit 555f28c

Browse files
pfalconpi-anl
authored andcommitted
unittest: Add dummy TestCase.subTest() context manager.
Just runs "subtests" in the scope of the main TestCase. Signed-off-by: Paul Sokolovsky <[email protected]>
1 parent 7d77774 commit 555f28c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

python-stdlib/unittest/unittest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,21 @@ def __exit__(self, exc_type, exc_value, tb):
2929
return False
3030

3131

32+
class NullContext:
33+
def __enter__(self):
34+
pass
35+
36+
def __exit__(self, a, b, c):
37+
pass
38+
39+
3240
class TestCase:
3341
def __init__(self):
3442
pass
3543

44+
def subTest(self, msg=None, **params):
45+
return NullContext()
46+
3647
def skipTest(self, reason):
3748
raise SkipTest(reason)
3849

0 commit comments

Comments
 (0)