#!/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")