Skip to content

Commit 2c0b508

Browse files
pfalconpi-anl
authored andcommitted
unittest: TestSuite: Add run() method.
For CPython compatibility. Signed-off-by: Paul Sokolovsky <[email protected]>
1 parent 04dce89 commit 2c0b508

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

python-stdlib/unittest/unittest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,16 @@ def __init__(self):
195195
def addTest(self, cls):
196196
self._tests.append(cls)
197197

198+
def run(self, result):
199+
for c in self._tests:
200+
result.exceptions.extend(run_suite(c, result))
201+
return result
202+
198203

199204
class TestRunner:
200205
def run(self, suite):
201206
res = TestResult()
202-
for c in suite._tests:
203-
res.exceptions.extend(run_suite(c, res))
207+
suite.run(res)
204208

205209
print("Ran %d tests\n" % res.testsRun)
206210
if res.failuresNum > 0 or res.errorsNum > 0:

0 commit comments

Comments
 (0)