mvp-factory-openhands/test-scripts/run_tests_direct.py

47 lines
1.2 KiB
Python

#!/usr/bin/env python3
# Execute tests directly
import sys
import os
# Add current directory to path
sys.path.insert(0, os.getcwd())
try:
print("=== PROJECT UNKNOWN - TEST EXECUTION ===")
print()
# Import the test module
from test_project_unknown import TestProjectUnknown
import unittest
# Create test suite and run
print("Running unit tests...")
suite = unittest.TestLoader().loadTestsFromTestCase(TestProjectUnknown)
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
print("\n" + "="*50)
print("TEST SUMMARY")
print("="*50)
print(f"Tests run: {result.testsRun}")
print(f"Failures: {len(result.failures)}")
print(f"Errors: {len(result.errors)}")
if result.wasSuccessful():
print("\n🎉 SUCCESS: All tests passed!")
# Also test the main module
print("\nTesting main module...")
from project_unknown import main
main()
print("\n✓ All tests completed successfully!")
else:
print("\n❌ FAILURE: Some tests failed!")
sys.exit(1)
except Exception as e:
print(f"Error executing tests: {e}")
import traceback
traceback.print_exc()
sys.exit(1)