MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / check_environment

Function check_environment

tests/run_tests.py:84–126  ·  view source on GitHub ↗

Check if required environment variables and dependencies are available.

()

Source from the content-addressed store, hash-verified

82 return True
83
84def check_environment():
85 """Check if required environment variables and dependencies are available."""
86 print("🔧 Checking test environment...")
87
88 # Check for .env file
89 env_file = project_root / ".env"
90 if env_file.exists():
91 print("✅ .env file found")
92 from dotenv import load_dotenv
93 load_dotenv(env_file)
94 else:
95 print("⚠️ No .env file found - some tests may fail without API keys")
96
97 # Check for API keys
98 api_keys = {
99 "GOOGLE_API_KEY": "Google AI embedder tests",
100 "OPENAI_API_KEY": "OpenAI integration tests"
101 }
102
103 for key, purpose in api_keys.items():
104 if os.getenv(key):
105 print(f"✅ {key} is set ({purpose})")
106 else:
107 print(f"⚠️ {key} not set - {purpose} may fail")
108
109 # Check Python dependencies
110 try:
111 import adalflow
112 print("✅ adalflow available")
113 except ImportError:
114 print("❌ adalflow not available - install with: pip install adalflow")
115
116 try:
117 import google.generativeai
118 print("✅ google-generativeai available")
119 except ImportError:
120 print("❌ google-generativeai not available - install with: pip install google-generativeai")
121
122 try:
123 import requests
124 print("✅ requests available")
125 except ImportError:
126 print("❌ requests not available - install with: pip install requests")
127
128def main():
129 parser = argparse.ArgumentParser(description="Run DeepWiki tests")

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected