Spaces:
Running on Zero
Running on Zero
| # ===================================================== | |
| # Apckeyl Framework | |
| # Version 1.0 | |
| # run_example_compute_provider_test.py | |
| # ===================================================== | |
| """ | |
| Test runner for Example Compute Provider. | |
| Version 1.0 | |
| """ | |
| import traceback | |
| from test_example_compute_provider import ( | |
| test_get_provider_info, | |
| test_health_check, | |
| test_supports_task, | |
| test_execute_success, | |
| test_execute_missing_task_id, | |
| test_execute_missing_task_type, | |
| test_execute_unsupported_task, | |
| ) | |
| # ===================================================== | |
| # Test Runner | |
| # ===================================================== | |
| def main(): | |
| tests = [ | |
| ( | |
| "test_get_provider_info", | |
| test_get_provider_info, | |
| ), | |
| ( | |
| "test_health_check", | |
| test_health_check, | |
| ), | |
| ( | |
| "test_supports_task", | |
| test_supports_task, | |
| ), | |
| ( | |
| "test_execute_success", | |
| test_execute_success, | |
| ), | |
| ( | |
| "test_execute_missing_task_id", | |
| test_execute_missing_task_id, | |
| ), | |
| ( | |
| "test_execute_missing_task_type", | |
| test_execute_missing_task_type, | |
| ), | |
| ( | |
| "test_execute_unsupported_task", | |
| test_execute_unsupported_task, | |
| ), | |
| ] | |
| passed = 0 | |
| failed = 0 | |
| print("=" * 60) | |
| print("APCKEYL FRAMEWORK") | |
| print("Example Compute Provider Test") | |
| print("Version 1.0") | |
| print("=" * 60) | |
| print() | |
| for test_name, test_function in tests: | |
| try: | |
| test_function() | |
| print( | |
| f"[PASS] {test_name}" | |
| ) | |
| passed += 1 | |
| except Exception as error: | |
| print( | |
| f"[FAIL] {test_name}" | |
| ) | |
| print( | |
| f" Error: {error}" | |
| ) | |
| print( | |
| traceback.format_exc() | |
| ) | |
| failed += 1 | |
| print() | |
| print("=" * 60) | |
| print("TEST SUMMARY") | |
| print("=" * 60) | |
| print( | |
| f"Total: {len(tests)}" | |
| ) | |
| print( | |
| f"Passed: {passed}" | |
| ) | |
| print( | |
| f"Failed: {failed}" | |
| ) | |
| print("=" * 60) | |
| if failed == 0: | |
| print( | |
| "RESULT: PASSED" | |
| ) | |
| return True | |
| print( | |
| "RESULT: FAILED" | |
| ) | |
| return False | |
| # ===================================================== | |
| # Direct Execution | |
| # ===================================================== | |
| if __name__ == "__main__": | |
| success = main() | |
| if not success: | |
| raise SystemExit(1) | |
| # ===================================================== | |
| # End of File | |
| # ===================================================== |