Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
161 lines
4.6 KiB
Python
161 lines
4.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Quick verification script for consolidated testing structure."""
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def run_command(cmd, description):
|
|
"""Run a command and return the result."""
|
|
print(f"\n🔍 {description}")
|
|
print(f"Command: {cmd}")
|
|
print("-" * 50)
|
|
|
|
try:
|
|
result = subprocess.run(
|
|
cmd,
|
|
shell=True,
|
|
capture_output=True,
|
|
text=True,
|
|
cwd="/home/will/Code/thechart",
|
|
)
|
|
if result.returncode == 0:
|
|
print("✅ SUCCESS")
|
|
if result.stdout:
|
|
print(result.stdout[:500]) # First 500 chars
|
|
else:
|
|
print("❌ FAILED")
|
|
if result.stderr:
|
|
print(result.stderr[:500])
|
|
return result.returncode == 0
|
|
except Exception as e:
|
|
print(f"❌ ERROR: {e}")
|
|
return False
|
|
|
|
|
|
def verify_test_structure():
|
|
"""Verify the consolidated test structure."""
|
|
print("🧪 TheChart Testing Structure Verification")
|
|
print("=" * 50)
|
|
|
|
# Check if we're in the right directory
|
|
if not os.path.exists("src/main.py"):
|
|
print("❌ Please run this script from the project root directory")
|
|
return False
|
|
|
|
# Check test directories exist
|
|
test_dirs = ["tests", "scripts"]
|
|
for dir_name in test_dirs:
|
|
if os.path.exists(dir_name):
|
|
print(f"✅ Directory {dir_name}/ exists")
|
|
else:
|
|
print(f"❌ Directory {dir_name}/ missing")
|
|
return False
|
|
|
|
# Check key test files exist
|
|
test_files = [
|
|
"tests/test_theme_manager.py",
|
|
"scripts/test_menu_theming.py",
|
|
"scripts/integration_test.py",
|
|
"docs/TESTING.md",
|
|
]
|
|
|
|
for file_path in test_files:
|
|
if os.path.exists(file_path):
|
|
print(f"✅ File {file_path} exists")
|
|
else:
|
|
print(f"❌ File {file_path} missing")
|
|
return False
|
|
|
|
# Check virtual environment
|
|
if os.path.exists(".venv/bin/python"):
|
|
print("✅ Virtual environment found")
|
|
else:
|
|
print("❌ Virtual environment not found")
|
|
return False
|
|
|
|
print("\n📋 Test Structure Summary:")
|
|
print("Unit Tests: tests/")
|
|
print("Integration Tests: scripts/")
|
|
print("Interactive Demos: scripts/")
|
|
print("Documentation: docs/TESTING.md")
|
|
|
|
return True
|
|
|
|
|
|
def run_test_verification():
|
|
"""Run basic test verification."""
|
|
print("\n🚀 Running Test Verification")
|
|
print("=" * 50)
|
|
|
|
success_count = 0
|
|
total_tests = 0
|
|
|
|
# Test 1: Unit test syntax check
|
|
total_tests += 1
|
|
if run_command(
|
|
"source .venv/bin/activate.fish && "
|
|
"python -m py_compile tests/test_theme_manager.py",
|
|
"Unit test syntax check",
|
|
):
|
|
success_count += 1
|
|
|
|
# Test 2: Integration test syntax check
|
|
total_tests += 1
|
|
if run_command(
|
|
"source .venv/bin/activate.fish && "
|
|
"python -m py_compile scripts/integration_test.py",
|
|
"Integration test syntax check",
|
|
):
|
|
success_count += 1
|
|
|
|
# Test 3: Demo script syntax check
|
|
total_tests += 1
|
|
if run_command(
|
|
"source .venv/bin/activate.fish && "
|
|
"python -m py_compile scripts/test_menu_theming.py",
|
|
"Demo script syntax check",
|
|
):
|
|
success_count += 1
|
|
|
|
# Test 4: Check if pytest is available
|
|
total_tests += 1
|
|
pytest_cmd = (
|
|
"source .venv/bin/activate.fish && "
|
|
"python -c 'import pytest; print(f\"pytest version: {pytest.__version__}\")'"
|
|
)
|
|
if run_command(pytest_cmd, "Pytest availability check"):
|
|
success_count += 1
|
|
|
|
print(f"\n📊 Test Verification Results: {success_count}/{total_tests} passed")
|
|
|
|
if success_count == total_tests:
|
|
print("✅ All verification tests passed!")
|
|
print("\n🎯 Next Steps:")
|
|
print("1. Run unit tests: python -m pytest tests/ -v")
|
|
print("2. Run integration test: python scripts/integration_test.py")
|
|
print("3. Try interactive demo: python scripts/test_menu_theming.py")
|
|
else:
|
|
print("❌ Some verification tests failed. Check the output above.")
|
|
|
|
return success_count == total_tests
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("🧪 TheChart Consolidated Testing Verification")
|
|
print("=" * 60)
|
|
|
|
# Verify structure
|
|
if not verify_test_structure():
|
|
print("\n❌ Test structure verification failed")
|
|
sys.exit(1)
|
|
|
|
# Run verification tests
|
|
if not run_test_verification():
|
|
print("\n❌ Test verification failed")
|
|
sys.exit(1)
|
|
|
|
print("\n🎉 All verification checks passed!")
|
|
print("📚 See docs/TESTING.md for complete testing guide")
|