AnsysLink/test/test_simple_state.py

44 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Simple state management test
"""
import sys
from pathlib import Path
# Add project root to path
sys.path.insert(0, str(Path(__file__).parent.parent))
def test_simple_state():
"""Simple test without Flask app"""
try:
print("Testing state manager import...")
from backend.utils.state_manager import state_manager
print("✓ State manager imported successfully")
print("Testing basic state operations...")
# Test initial state
status = state_manager.get_processing_status()
print(f"✓ Initial status: {status.status} - {status.message}")
# Test state changes
state_manager.set_processing_status('PROCESSING', 'Test processing')
status = state_manager.get_processing_status()
print(f"✓ Updated status: {status.status} - {status.message}")
# Test system state
system_state = state_manager.get_system_state()
print(f"✓ System state keys: {list(system_state.keys())}")
print("✓ All basic state operations working")
except Exception as e:
print(f"✗ Error: {e}")
import traceback
traceback.print_exc()
if __name__ == '__main__':
print("Simple State Management Test")
print("=" * 30)
test_simple_state()
print("Test completed")