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.
pull/121/merge
Paul Sokolovsky 2017-09-02 17:30:27 +03:00
rodzic ec67618df1
commit 74140defb7
1 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -172,15 +172,22 @@ def run_class(c, test_result):
if name.startswith("test"):
print(name, end=' ...')
m = getattr(o, name)
try:
set_up()
try:
test_result.testsRun += 1
m()
tear_down()
print(" ok")
except SkipTest as e:
print(" skipped:", e.args[0])
test_result.skippedNum += 1
except:
print(" FAIL")
test_result.failuresNum += 1
# Uncomment to investigate failure in detail
#raise
continue
finally:
tear_down()
def main(module="__main__"):