136 lines
3.7 KiB
Python
136 lines
3.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Quick Test Script - Verify Project Structure
|
|
|
|
Run this to verify the restructuring was successful.
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
def check_structure():
|
|
"""Verify all required directories and files exist"""
|
|
root = Path(__file__).parent
|
|
|
|
print("🔍 Checking project structure...\n")
|
|
|
|
required_items = {
|
|
"Directories": [
|
|
"assets/0_input",
|
|
"assets/1_processed",
|
|
"assets/2_output",
|
|
"backend",
|
|
"frontend/src",
|
|
"frontend/src/components",
|
|
],
|
|
"Python Files": [
|
|
"main.py",
|
|
"requirements.txt",
|
|
"backend/__init__.py",
|
|
"backend/extractor.py",
|
|
"backend/scripter.py",
|
|
"backend/media_fetcher.py",
|
|
"backend/data_builder.py",
|
|
],
|
|
"TypeScript Files": [
|
|
"frontend/src/render-props-types.ts",
|
|
],
|
|
"Config Files": [
|
|
".env.example",
|
|
"remotion.config.ts",
|
|
"package.json",
|
|
],
|
|
"Documentation": [
|
|
"PROJECT_README.md",
|
|
"MIGRATION_GUIDE.md",
|
|
"RESTRUCTURING_SUMMARY.md",
|
|
],
|
|
}
|
|
|
|
all_ok = True
|
|
|
|
for category, items in required_items.items():
|
|
print(f"📁 {category}:")
|
|
for item in items:
|
|
path = root / item
|
|
exists = path.exists()
|
|
symbol = "✅" if exists else "❌"
|
|
print(f" {symbol} {item}")
|
|
if not exists:
|
|
all_ok = False
|
|
print()
|
|
|
|
if all_ok:
|
|
print("✅ All required files and directories exist!\n")
|
|
print("📋 Next Steps:")
|
|
print("1. Review RESTRUCTURING_SUMMARY.md")
|
|
print("2. Follow MIGRATION_GUIDE.md to move existing files")
|
|
print("3. Install dependencies: pip install -r requirements.txt")
|
|
print("4. Configure .env: cp .env.example .env")
|
|
print("5. Test backend: python main.py --pdf test.pdf --dry-run")
|
|
else:
|
|
print("❌ Some files are missing. Please check the structure.\n")
|
|
sys.exit(1)
|
|
|
|
def test_imports():
|
|
"""Test that backend modules can be imported"""
|
|
print("\n🔬 Testing Python imports...\n")
|
|
|
|
try:
|
|
import backend
|
|
print("✅ backend package")
|
|
except ImportError as e:
|
|
print(f"❌ backend package: {e}")
|
|
return False
|
|
|
|
modules = ["extractor", "scripter", "media_fetcher", "data_builder"]
|
|
for module_name in modules:
|
|
try:
|
|
__import__(f"backend.{module_name}")
|
|
print(f"✅ backend.{module_name}")
|
|
except ImportError as e:
|
|
print(f"❌ backend.{module_name}: {e}")
|
|
return False
|
|
|
|
print("\n✅ All imports successful!")
|
|
return True
|
|
|
|
def test_cli():
|
|
"""Test main.py CLI"""
|
|
print("\n🚀 Testing main.py CLI...\n")
|
|
|
|
import subprocess
|
|
|
|
try:
|
|
result = subprocess.run(
|
|
[sys.executable, "main.py", "--help"],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=5
|
|
)
|
|
|
|
if result.returncode == 0:
|
|
print("✅ main.py --help works")
|
|
return True
|
|
else:
|
|
print(f"❌ main.py --help failed: {result.stderr}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ CLI test failed: {e}")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
print("=" * 60)
|
|
print("Auto Life Plan Video Generator - Structure Verification")
|
|
print("=" * 60)
|
|
print()
|
|
|
|
check_structure()
|
|
|
|
if test_imports():
|
|
test_cli()
|
|
|
|
print("\n" + "=" * 60)
|
|
print("✅ Verification complete!")
|
|
print("=" * 60)
|