lockdrop-simulation/tests/run_all_tests.py
2025-08-04 14:10:17 +05:30

71 lines
1.9 KiB
Python
Executable File

"""
Test runner for all lockdrop allocation comparison tests.
This script runs all test modules in the correct order:
1. Allocation tests (star, galaxy, total)
2. Unlock schedule tests
3. Accrual state tests
Usage:
python run_all_tests.py
Environment variables required:
REST_API_ENDPOINT - REST API endpoint for zenithd
RPC_API_ENDPOINT - RPC API endpoint for zenithd
"""
import sys
import unittest
import os
# Add the tests directory to the path so we can import the test modules
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
# Import test classes
from test_allocations import AllocationTest
from test_unlock_schedule import UnlockScheduleTest
from test_accrual_state import AccrualStateTest
def create_test_suite():
"""Create a test suite with all tests in the desired order"""
suite = unittest.TestSuite()
# Add allocation tests
suite.addTest(AllocationTest('test_0_star_allocations'))
suite.addTest(AllocationTest('test_1_galaxy_allocations'))
suite.addTest(AllocationTest('test_2_total_allocations'))
# Add unlock schedule tests
suite.addTest(UnlockScheduleTest('test_unlock_schedule_calculation'))
# Add accrual state tests
suite.addTest(AccrualStateTest('test_accrual_state_calculation'))
return suite
def main():
"""Run all tests with detailed output"""
print("="*80)
print("LOCKDROP ALLOCATION COMPARISON TESTS")
print("="*80)
# Check environment variables
if not os.getenv('REST_API_ENDPOINT'):
print("ERROR: REST_API_ENDPOINT environment variable not set")
sys.exit(1)
if not os.getenv('RPC_API_ENDPOINT'):
print("ERROR: RPC_API_ENDPOINT environment variable not set")
sys.exit(1)
# Create and run test suite
suite = create_test_suite()
runner = unittest.TextTestRunner(verbosity=2, stream=sys.stdout)
runner.run(suite)
if __name__ == "__main__":
main()