51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
import importlib
|
|
import sys
|
|
import traceback
|
|
|
|
TEST_MODULES = [
|
|
"tests.test_run_full_pipeline_smoke",
|
|
"tests.test_wrappers_delegation",
|
|
]
|
|
|
|
|
|
def run_module_tests(mod_name):
|
|
mod = importlib.import_module(mod_name)
|
|
failures = 0
|
|
for name in dir(mod):
|
|
if name.startswith("test_") and callable(getattr(mod, name)):
|
|
fn = getattr(mod, name)
|
|
try:
|
|
fn()
|
|
print(f"[OK] {mod_name}.{name}")
|
|
except AssertionError:
|
|
failures += 1
|
|
print(f"[FAIL] {mod_name}.{name}")
|
|
traceback.print_exc()
|
|
except Exception:
|
|
failures += 1
|
|
print(f"[ERROR] {mod_name}.{name}")
|
|
traceback.print_exc()
|
|
return failures
|
|
|
|
|
|
def main():
|
|
total_fail = 0
|
|
for m in TEST_MODULES:
|
|
total_fail += run_module_tests(m)
|
|
|
|
# tests adicionales añadidos dinámicamente
|
|
extra = [
|
|
"tests.test_marian_adapter",
|
|
]
|
|
for m in extra:
|
|
total_fail += run_module_tests(m)
|
|
|
|
if total_fail:
|
|
print(f"\n{total_fail} tests failed")
|
|
sys.exit(1)
|
|
print("\nAll tests passed")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|