kopia lustrzana https://github.com/micropython/micropython-lib
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
rodzic
ec67618df1
commit
74140defb7
|
@ -172,15 +172,22 @@ def run_class(c, test_result):
|
||||||
if name.startswith("test"):
|
if name.startswith("test"):
|
||||||
print(name, end=' ...')
|
print(name, end=' ...')
|
||||||
m = getattr(o, name)
|
m = getattr(o, name)
|
||||||
try:
|
|
||||||
set_up()
|
set_up()
|
||||||
|
try:
|
||||||
test_result.testsRun += 1
|
test_result.testsRun += 1
|
||||||
m()
|
m()
|
||||||
tear_down()
|
|
||||||
print(" ok")
|
print(" ok")
|
||||||
except SkipTest as e:
|
except SkipTest as e:
|
||||||
print(" skipped:", e.args[0])
|
print(" skipped:", e.args[0])
|
||||||
test_result.skippedNum += 1
|
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__"):
|
def main(module="__main__"):
|
||||||
|
|
Ładowanie…
Reference in New Issue