-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_installation.py
More file actions
61 lines (50 loc) · 1.74 KB
/
Copy pathtest_installation.py
File metadata and controls
61 lines (50 loc) · 1.74 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
"""
Test script to verify valkeyrie package installation
Run this AFTER installing from PyPI: pip install valkeyrie
"""
def test_import():
"""Test that package can be imported"""
try:
from valkeyrie import ValkeyreClient
print("✅ Import successful!")
return True
except ImportError as e:
print(f"❌ Import failed: {e}")
return False
def test_connection():
"""Test connection to Valkeyrie server (requires running server)"""
try:
from valkeyrie import ValkeyreClient
client = ValkeyreClient('127.0.0.1', 6379)
if client.connect():
print("✅ Connection successful!")
# Test basic operations
client.set('test_key', 'test_value')
value = client.get('test_key')
if value == 'test_value':
print("✅ Basic operations work!")
else:
print(f"❌ Unexpected value: {value}")
client.delete('test_key')
client.disconnect()
return True
else:
print("⚠️ Could not connect to server (make sure Valkeyrie is running)")
return False
except Exception as e:
print(f"❌ Connection test failed: {e}")
return False
def main():
print("🧪 Testing Valkeyrie Package Installation\n")
# Test 1: Import
print("Test 1: Package Import")
import_ok = test_import()
print()
# Test 2: Connection (optional)
if import_ok:
print("Test 2: Server Connection")
print("(Make sure Valkeyrie server is running on localhost:6379)")
test_connection()
print("\n✨ Tests complete!")
if __name__ == '__main__':
main()