Buckets:

download
raw
7.25 kB
#!/usr/bin/env python3
"""
Comprehensive Tour Testing Script
================================
Tests all tour steps by simulating user input
"""
import os
import sys
import subprocess
from pathlib import Path
def test_tour_steps():
"""Test individual tour components without full interactive mode."""
results = {"passed": [], "failed": [], "warnings": []}
print("๐Ÿงช Testing MyWork-AI Tour Components...")
print("=" * 50)
# Test 1: mw status (used in tour step 2)
print("\n1. Testing: mw status")
try:
result = subprocess.run([sys.executable, "-m", "tools.mw", "status"],
capture_output=True, text=True, timeout=10)
if result.returncode == 0 and ("โœ…" in result.stdout or "healthy" in result.stdout.lower()):
results["passed"].append("mw status - works correctly")
print(" โœ… PASS: mw status works")
else:
results["failed"].append(f"mw status - exit code {result.returncode}")
print(f" โŒ FAIL: mw status returned {result.returncode}")
except Exception as e:
results["failed"].append(f"mw status - exception: {e}")
print(f" โŒ ERROR: {e}")
# Test 2: mw projects (used in tour step 3)
print("\n2. Testing: mw projects")
try:
result = subprocess.run([sys.executable, "-m", "tools.mw", "projects"],
capture_output=True, text=True, timeout=10)
if result.returncode == 0:
results["passed"].append("mw projects - lists projects successfully")
print(" โœ… PASS: mw projects works")
# Check if it shows some projects or a helpful message
if result.stdout.strip():
print(f" ๐Ÿ“Š Found output: {len(result.stdout.strip().splitlines())} lines")
else:
results["warnings"].append("mw projects - no output (might be empty)")
else:
results["failed"].append(f"mw projects - exit code {result.returncode}")
print(f" โŒ FAIL: mw projects returned {result.returncode}")
except Exception as e:
results["failed"].append(f"mw projects - exception: {e}")
print(f" โŒ ERROR: {e}")
# Test 3: mw new (used in tour step 4)
print("\n3. Testing: mw new test-tour-project basic")
try:
# Create project in /tmp to avoid cluttering
os.chdir("/tmp")
result = subprocess.run([sys.executable, "-m", "tools.mw", "new", "test-tour-project", "basic"],
capture_output=True, text=True, timeout=15,
cwd="/home/Memo1981/MyWork-AI")
if result.returncode == 0 and "Project created" in result.stdout:
results["passed"].append("mw new - creates projects successfully")
print(" โœ… PASS: mw new creates project")
# Verify project was actually created
if Path("/tmp/test-tour-project").exists():
print(" โœ… Project directory exists")
else:
results["warnings"].append("mw new - project directory not found")
else:
results["failed"].append(f"mw new - exit code {result.returncode}")
print(f" โŒ FAIL: mw new returned {result.returncode}")
if result.stderr:
print(f" ๐Ÿ“ Error output: {result.stderr.strip()}")
except Exception as e:
results["failed"].append(f"mw new - exception: {e}")
print(f" โŒ ERROR: {e}")
# Test 4: mw brain stats (used in tour step 5)
print("\n4. Testing: mw brain stats")
try:
os.chdir("/home/Memo1981/MyWork-AI")
result = subprocess.run([sys.executable, "-m", "tools.mw", "brain", "stats"],
capture_output=True, text=True, timeout=10)
if result.returncode == 0:
results["passed"].append("mw brain stats - shows knowledge vault stats")
print(" โœ… PASS: mw brain stats works")
else:
results["failed"].append(f"mw brain stats - exit code {result.returncode}")
print(f" โŒ FAIL: mw brain stats returned {result.returncode}")
except Exception as e:
results["failed"].append(f"mw brain stats - exception: {e}")
print(f" โŒ ERROR: {e}")
# Test 5: mw doctor --quick (used in tour step 6)
print("\n5. Testing: mw doctor --quick")
try:
result = subprocess.run([sys.executable, "-m", "tools.mw", "doctor", "--quick"],
capture_output=True, text=True, timeout=20)
if result.returncode == 0:
results["passed"].append("mw doctor --quick - runs diagnostics")
print(" โœ… PASS: mw doctor --quick works")
else:
# Doctor might return non-zero for issues, but still be functional
if "ERROR" not in result.stdout.upper() and "FAILED" not in result.stdout.upper():
results["warnings"].append("mw doctor --quick - returned non-zero but seems functional")
print(f" โš ๏ธ WARNING: doctor returned {result.returncode} but appears functional")
else:
results["failed"].append(f"mw doctor --quick - serious errors detected")
print(f" โŒ FAIL: doctor has serious errors")
except Exception as e:
results["failed"].append(f"mw doctor --quick - exception: {e}")
print(f" โŒ ERROR: {e}")
# Test 6: Tour help and guidance
print("\n6. Testing: mw tour --help")
try:
result = subprocess.run([sys.executable, "-m", "tools.mw", "tour", "--help"],
capture_output=True, text=True, timeout=5)
if result.returncode == 0 and "tour" in result.stdout.lower():
results["passed"].append("mw tour --help - shows help information")
print(" โœ… PASS: tour help works")
else:
results["failed"].append("mw tour --help - no help available")
print(" โŒ FAIL: tour help not working")
except Exception as e:
results["warnings"].append(f"mw tour --help - might not have help: {e}")
print(f" โš ๏ธ WARNING: tour help might not be implemented: {e}")
# Final Summary
print("\n" + "=" * 50)
print("๐Ÿ TOUR TESTING SUMMARY")
print("=" * 50)
print(f"โœ… PASSED ({len(results['passed'])}):")
for item in results["passed"]:
print(f" โ€ข {item}")
if results["warnings"]:
print(f"\nโš ๏ธ WARNINGS ({len(results['warnings'])}):")
for item in results["warnings"]:
print(f" โ€ข {item}")
if results["failed"]:
print(f"\nโŒ FAILED ({len(results['failed'])}):")
for item in results["failed"]:
print(f" โ€ข {item}")
else:
print("\n๐ŸŽ‰ All critical tour components are working!")
print(f"\nOverall: {len(results['passed'])} passed, {len(results['warnings'])} warnings, {len(results['failed'])} failed")
return len(results['failed']) == 0
if __name__ == "__main__":
os.chdir("/home/Memo1981/MyWork-AI")
success = test_tour_steps()
sys.exit(0 if success else 1)

Xet Storage Details

Size:
7.25 kB
ยท
Xet hash:
42d0c9c81a2f68e434c33348a9b33190caa4949036519a2680c6cceaecc8f176

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.