mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Update unit-tests script.
This commit is contained in:
parent
3a7bb9487c
commit
8557d55745
@ -18,22 +18,19 @@ def print_result(test, passed):
|
|||||||
padding = "."*(60-len(s))
|
padding = "."*(60-len(s))
|
||||||
print(s + padding + ("PASSED" if passed == True else "FAILED"))
|
print(s + padding + ("PASSED" if passed == True else "FAILED"))
|
||||||
|
|
||||||
for module in sorted(os.listdir(SCRIPT_DIR)):
|
for test in sorted(os.listdir(SCRIPT_DIR)):
|
||||||
mod_path = "/".join((SCRIPT_DIR, module))
|
if test.endswith(".py"):
|
||||||
|
test_passed = True
|
||||||
for test in sorted(os.listdir(mod_path)):
|
test_path = "/".join((SCRIPT_DIR, test))
|
||||||
if test.endswith(".py"):
|
try:
|
||||||
test_passed = True
|
exec(open(test_path).read())
|
||||||
test_path = "/".join((mod_path, test))
|
gc.collect()
|
||||||
try:
|
if unittest(DATA_DIR, TEMP_DIR) == False:
|
||||||
exec(open(test_path).read())
|
raise Exception()
|
||||||
gc.collect()
|
except Exception as e:
|
||||||
if unittest(DATA_DIR, TEMP_DIR) == False:
|
test_failed = True
|
||||||
raise Exception()
|
test_passed = False
|
||||||
except Exception as e:
|
print_result(test, test_passed)
|
||||||
test_failed = True
|
|
||||||
test_passed = False
|
|
||||||
print_result(test, test_passed)
|
|
||||||
|
|
||||||
if test_failed:
|
if test_failed:
|
||||||
print("\nSome tests have FAILED!!!\n\n")
|
print("\nSome tests have FAILED!!!\n\n")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user