-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_installation.py
More file actions
171 lines (152 loc) · 4.18 KB
/
test_installation.py
File metadata and controls
171 lines (152 loc) · 4.18 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
167
168
169
170
171
# Quick Test Script for SNATT
# Run this to verify installation and basic functionality
import sys
import os
# Add src to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
print("="*60)
print("SNATT - Installation & Syntax Check")
print("="*60)
print()
# Test 1: Check Python version
print("1. Checking Python version...")
if sys.version_info < (3, 8):
print(" ❌ FAILED: Python 3.8+ required")
print(f" Current version: {sys.version}")
sys.exit(1)
else:
print(f" ✅ PASSED: Python {sys.version_info.major}.{sys.version_info.minor}")
print()
# Test 2: Check if requirements are met
print("2. Checking dependencies...")
required_packages = [
'customtkinter',
'netmiko',
'napalm',
'paramiko',
'scapy',
'pandas',
'openpyxl',
'keyring',
'cryptography',
'colorlog'
]
missing = []
for package in required_packages:
try:
__import__(package)
print(f" ✅ {package}")
except ImportError:
print(f" ❌ {package} - NOT INSTALLED")
missing.append(package)
if missing:
print()
print(" Missing packages detected!")
print(" Run: pip install -r requirements.txt")
print()
else:
print()
print(" All dependencies installed!")
print()
# Test 3: Check directory structure
print("3. Checking directory structure...")
required_dirs = [
'src',
'src/engines',
'src/models',
'src/utils',
'src/gui',
'config',
'docs',
'tests',
]
for directory in required_dirs:
if os.path.exists(directory):
print(f" ✅ {directory}/")
else:
print(f" ❌ {directory}/ - MISSING")
print()
# Test 4: Check key files
print("4. Checking key files...")
required_files = [
'src/main.py',
'src/engines/discovery_engine.py',
'src/engines/connection_manager.py',
'src/engines/troubleshooting_engine.py',
'src/engines/backup_manager.py',
'src/engines/reporting_engine.py',
'src/gui/main_window.py',
'src/gui/discovery_panel.py',
'src/gui/diagnostics_panel.py',
'src/gui/backup_panel.py',
'src/gui/reports_panel.py',
'src/gui/settings_panel.py',
'config/default_config.json',
'requirements.txt',
]
for filepath in required_files:
if os.path.exists(filepath):
print(f" ✅ {filepath}")
else:
print(f" ❌ {filepath} - MISSING")
print()
# Test 5: Syntax check Python files (if no imports needed)
print("5. Checking Python syntax...")
try:
import py_compile
python_files = [
'src/main.py',
'src/utils/logger.py',
'src/utils/config_manager.py',
'src/utils/credential_manager.py',
'src/utils/validators.py',
'src/models/device.py',
'src/models/diagnostic_result.py',
'src/models/backup_record.py',
]
syntax_ok = True
for pyfile in python_files:
if os.path.exists(pyfile):
try:
py_compile.compile(pyfile, doraise=True)
print(f" ✅ {pyfile}")
except py_compile.PyCompileError as e:
print(f" ❌ {pyfile} - SYNTAX ERROR")
print(f" {e}")
syntax_ok = False
if syntax_ok:
print()
print(" All checked files have valid syntax!")
else:
print()
print(" Some files have syntax errors!")
print()
except Exception as e:
print(f" ⚠️ Could not perform syntax check: {e}")
print()
# Summary
print("="*60)
print("SUMMARY")
print("="*60)
if not missing and sys.version_info >= (3, 8):
print("✅ SNATT is ready to run!")
print()
print("To start the application:")
print(" python src/main.py")
print()
print("For first-time setup:")
print(" 1. Click 'Settings' in the GUI")
print(" 2. Go to 'Credentials' tab")
print(" 3. Add your device credentials")
print(" 4. Start discovering devices!")
print()
else:
print("⚠️ SNATT needs setup!")
print()
if sys.version_info < (3, 8):
print(" - Upgrade Python to 3.8 or higher")
if missing:
print(" - Install missing dependencies:")
print(" pip install -r requirements.txt")
print()
print("="*60)