-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_integration.py
More file actions
166 lines (132 loc) · 5.17 KB
/
test_integration.py
File metadata and controls
166 lines (132 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/usr/bin/env python3
"""
LocalMind Integration Test
Simple test to verify all components can be imported and initialized.
"""
import sys
import os
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
def test_imports():
"""Test that all major components can be imported."""
print("🧪 Testing LocalMind component imports...")
try:
# Test configuration loading
import yaml
print(" ✅ YAML configuration support")
# Test core components
from model.engine import ModelEngine
print(" ✅ Model Engine")
from knowledge.vector_db import VectorDatabase
print(" ✅ Vector Database")
from utils.resource_manager import ResourceManager
print(" ✅ Resource Manager")
from utils.security import SecurityManager
print(" ✅ Security Manager")
# Test domain modules
from domains.education import EducationDomain
print(" ✅ Education Domain")
from domains.healthcare import HealthcareDomain
print(" ✅ Healthcare Domain")
from domains.general import GeneralDomain
print(" ✅ General Domain")
# Test interfaces
try:
from interface.cli import LocalMindCLI
print(" ✅ CLI Interface")
except ImportError as e:
print(f" ⚠️ CLI Interface (missing dependencies: {e})")
try:
from interface.gui import LocalMindGUI
print(" ✅ GUI Interface")
except ImportError as e:
print(f" ⚠️ GUI Interface (missing dependencies: {e})")
# Test main app
from app import LocalMindApp
print(" ✅ Main Application")
print("\n✅ All core components imported successfully!")
return True
except ImportError as e:
print(f"\n❌ Import failed: {e}")
return False
def test_configuration():
"""Test configuration loading."""
print("\n🧪 Testing configuration loading...")
try:
config_path = Path(__file__).parent / "src" / "config.yaml"
if config_path.exists():
with open(config_path, 'r') as f:
import yaml
config = yaml.safe_load(f)
# Check key configuration sections
required_sections = ['model', 'domains', 'interface', 'security', 'resources']
missing_sections = []
for section in required_sections:
if section in config:
print(f" ✅ {section} configuration")
else:
missing_sections.append(section)
print(f" ❌ {section} configuration missing")
if not missing_sections:
print("\n✅ Configuration file is complete!")
return True
else:
print(f"\n⚠️ Missing configuration sections: {missing_sections}")
return False
else:
print(" ❌ config.yaml not found")
return False
except Exception as e:
print(f"\n❌ Configuration test failed: {e}")
return False
def test_basic_functionality():
"""Test basic functionality without model loading."""
print("\n🧪 Testing basic functionality...")
try:
# Import main app
from app import LocalMindApp
# Try to initialize (without actually loading models)
config_path = Path(__file__).parent / "src" / "config.yaml"
if config_path.exists():
app = LocalMindApp(str(config_path))
print(" ✅ Application initialization")
# Test that domains can be initialized
if hasattr(app, 'domains'):
print(" ✅ Domain structure ready")
print("\n✅ Basic functionality test passed!")
return True
else:
print(" ❌ Configuration file not found")
return False
except Exception as e:
print(f"\n❌ Functionality test failed: {e}")
return False
def main():
"""Run all tests."""
print("🚀 LocalMind Integration Test Suite")
print("=" * 50)
tests = [
test_imports,
test_configuration,
test_basic_functionality
]
results = []
for test in tests:
results.append(test())
print("\n" + "=" * 50)
if all(results):
print("🎉 All tests passed! LocalMind is ready to use.")
print("\nNext steps:")
print("1. Run: python src/app.py --setup")
print("2. Then: python src/app.py --cli")
return 0
else:
print("❌ Some tests failed. Please check the output above.")
print("\nTroubleshooting:")
print("1. Install dependencies: pip install -r requirements.txt")
print("2. Check Python version: python --version (3.8+ required)")
print("3. Verify file structure in src/ directory")
return 1
if __name__ == "__main__":
sys.exit(main())