Skip to content

Commit 74140de

Browse files
author
Paul Sokolovsky
committed
unittest: Run testcases more correctly, count failures.
Test methdos are now run wrapped in try/except/finally. failures are counted, instead of aborting on the first.
1 parent ec67618 commit 74140de

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

unittest/unittest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,22 @@ def run_class(c, test_result):
172172
if name.startswith("test"):
173173
print(name, end=' ...')
174174
m = getattr(o, name)
175+
set_up()
175176
try:
176-
set_up()
177177
test_result.testsRun += 1
178178
m()
179-
tear_down()
180179
print(" ok")
181180
except SkipTest as e:
182181
print(" skipped:", e.args[0])
183182
test_result.skippedNum += 1
183+
except:
184+
print(" FAIL")
185+
test_result.failuresNum += 1
186+
# Uncomment to investigate failure in detail
187+
#raise
188+
continue
189+
finally:
190+
tear_down()
184191

185192

186193
def main(module="__main__"):

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