Execute all test functions and return exit code.
()
| 103 | |
| 104 | |
| 105 | def run_tests(): |
| 106 | """Execute all test functions and return exit code.""" |
| 107 | tests = [ |
| 108 | test_import, |
| 109 | test_autoload_modules, |
| 110 | test_sanity_create_image, |
| 111 | test_property_view_packaged, |
| 112 | ] |
| 113 | |
| 114 | passed = 0 |
| 115 | failed = 0 |
| 116 | |
| 117 | for test in tests: |
| 118 | name = test.__name__ |
| 119 | try: |
| 120 | test() |
| 121 | passed += 1 |
| 122 | except Exception as e: |
| 123 | print(f" FAILED: {name}: {e}", file=sys.stderr) |
| 124 | failed += 1 |
| 125 | |
| 126 | print(f"\n{passed} passed, {failed} failed") |
| 127 | return 1 if failed else 0 |
| 128 | |
| 129 | |
| 130 | # --------------------------------------------------------------------------- |