forked from geeknik/mmm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_test.py
More file actions
66 lines (54 loc) · 1.92 KB
/
quick_test.py
File metadata and controls
66 lines (54 loc) · 1.92 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
#!/usr/bin/env python3
"""
Quick test to verify CLI commands are working
"""
import subprocess
import sys
def test_command(cmd, timeout=10):
"""Test if command starts without immediate errors"""
try:
result = subprocess.run(
f"source mmm_env/bin/activate && timeout {timeout} {cmd} 2>&1",
shell=True,
capture_output=True,
text=True
)
# Check for config errors
if "'Command' object has no attribute 'config'" in result.stderr:
return False, "Config error still present"
# Check for immediate Python errors
if "Traceback" in result.stderr or "Error:" in result.stderr:
return False, f"Python error: {result.stderr[:100]}"
# Check if banner appears (indicates CLI started)
if "MELODIC METADATA MASSACRER" in result.stdout:
return True, "CLI started successfully"
return True, "No immediate errors"
except subprocess.TimeoutExpired:
return True, "Process started but timed out (expected)"
except Exception as e:
return False, f"Exception: {e}"
def main():
print("🧪 Quick CLI Test")
print("="*50)
tests = [
("python -m mmm.cli --help", "Help command"),
("python -m mmm.cli analyze --help", "Analyze help"),
("python -m mmm.cli obliterate --help", "Obliterate help"),
("python -m mmm.cli massacre --help", "Massacre help")
]
all_passed = True
for cmd, desc in tests:
passed, message = test_command(cmd)
status = "✅" if passed else "❌"
print(f"{status} {desc}: {message}")
if not passed:
all_passed = False
print("\n" + "="*50)
if all_passed:
print("🎉 All tests passed! CLI is working correctly.")
return 0
else:
print("⚠️ Some tests failed. Check output above.")
return 1
if __name__ == "__main__":
sys.exit(main())