Skip to content

Commit 82386e8

Browse files
committed
unittest: Test stats are now printed by TestRunner.run().
Like done by CPython version.
1 parent 74140de commit 82386e8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

unittest/unittest.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ def run(self, suite):
151151
res = TestResult()
152152
for c in suite.tests:
153153
run_class(c, res)
154+
155+
print("Ran %d tests\n" % res.testsRun)
156+
if res.failuresNum > 0 or res.errorsNum > 0:
157+
print("FAILED (failures=%d, errors=%d)" % (res.failuresNum, res.errorsNum))
158+
else:
159+
msg = "OK"
160+
if res.skippedNum > 0:
161+
msg += " (%d skipped)" % res.skippedNum
162+
print(msg)
163+
154164
return res
155165

156166
class TestResult:
@@ -203,7 +213,3 @@ def test_cases(m):
203213
suite.addTest(c)
204214
runner = TestRunner()
205215
result = runner.run(suite)
206-
msg = "Ran %d tests" % result.testsRun
207-
if result.skippedNum > 0:
208-
msg += " (%d skipped)" % result.skippedNum
209-
print(msg)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy