-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_installation.py
More file actions
executable file
·57 lines (45 loc) · 1.57 KB
/
test_installation.py
File metadata and controls
executable file
·57 lines (45 loc) · 1.57 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
#!/usr/bin/env python3
"""
Test script to verify that the jess package is installed correctly.
"""
import sys
import importlib.util
def check_module(module_name):
"""Check if a module can be imported."""
try:
importlib.import_module(module_name)
return True
except ImportError:
return False
def main():
"""Main function to test the installation."""
print("Testing jess installation...")
# Check if jess is installed
if not check_module("jess"):
print("❌ jess package is not installed.")
sys.exit(1)
# Check required dependencies
dependencies = ["paramiko", "yaml", "colorama", "tabulate"]
# Note: PyYAML is imported as 'yaml' in Python
missing = []
for dep in dependencies:
if not check_module(dep):
missing.append(dep)
if missing:
print(f"❌ Missing dependencies: {', '.join(missing)}")
sys.exit(1)
# Try to import specific modules
try:
from jess import __version__
print(f"✅ jess version {__version__} is installed correctly!")
# Import key modules to verify they exist
from jess.connection import manager, ssh, telnet
from jess.inventory import manager as inv_manager, parser
from jess.utils import colors
print("✅ All required modules are available.")
print("Installation test completed successfully.")
except ImportError as e:
print(f"❌ Error importing jess modules: {e}")
sys.exit(1)
if __name__ == "__main__":
main()