web3-copilot / test_app.py
Priyanshi Saxena
feat: added api tools
f104fee
raw
history blame
3.49 kB
#!/usr/bin/env python3
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
def test_imports():
try:
print("Testing imports...")
# Test basic Python modules
import json
import asyncio
from datetime import datetime
from typing import List, Tuple
print("βœ… Basic Python modules imported successfully")
# Test installed packages
import gradio as gr
print("βœ… Gradio imported successfully")
import aiohttp
print("βœ… aiohttp imported successfully")
import plotly
print("βœ… Plotly imported successfully")
import pandas
print("βœ… Pandas imported successfully")
import pydantic
print("βœ… Pydantic imported successfully")
# Test LangChain
import langchain
from langchain.agents import AgentExecutor
from langchain_google_genai import ChatGoogleGenerativeAI
print("βœ… LangChain modules imported successfully")
# Test our modules
from src.utils.config import config
from src.utils.logger import get_logger
print("βœ… Config and logger imported successfully")
from src.tools.base_tool import BaseWeb3Tool
from src.tools.coingecko_tool import CoinGeckoTool
from src.tools.defillama_tool import DeFiLlamaTool
from src.tools.etherscan_tool import EtherscanTool
print("βœ… Tools imported successfully")
from src.agent.research_agent import Web3ResearchAgent
from src.agent.query_planner import QueryPlanner
print("βœ… Agent modules imported successfully")
from src.api.airaa_integration import AIRAAIntegration
print("βœ… AIRAA integration imported successfully")
from src.visualizations import create_price_chart, create_market_overview
print("βœ… Visualizations imported successfully")
# Test app import
from app import Web3CoPilotApp
print("βœ… Main app imported successfully")
print("\nπŸŽ‰ All imports successful! The application is ready to run.")
return True
except ImportError as e:
print(f"❌ Import error: {e}")
return False
except Exception as e:
print(f"❌ Unexpected error: {e}")
return False
def test_app_initialization():
try:
print("\nTesting app initialization...")
# This will test if we can create the app instance
# but won't actually run it
os.environ.setdefault('GEMINI_API_KEY', 'test_key_for_import_test')
from app import Web3CoPilotApp
print("βœ… App class imported successfully")
# Test if we can create the interface (but don't launch)
app = Web3CoPilotApp()
interface = app.create_interface()
print("βœ… App interface created successfully")
print("\nπŸš€ Application is fully functional and ready to launch!")
return True
except Exception as e:
print(f"❌ App initialization error: {e}")
return False
if __name__ == "__main__":
print("=" * 60)
print("Web3 Research Co-Pilot - Application Test")
print("=" * 60)
success = test_imports()
if success:
test_app_initialization()
print("=" * 60)
print("Test complete!")