-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
executable file
·141 lines (118 loc) · 4.38 KB
/
Copy pathrun_tests.py
File metadata and controls
executable file
·141 lines (118 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env python3
"""
MindCare Test Runner
Choose your testing method based on your setup
"""
import os
import sys
import subprocess
def check_dependencies():
"""Check what dependencies are available"""
available = {}
try:
import flask
available['flask'] = True
except ImportError:
available['flask'] = False
try:
import firebase_admin
available['firebase'] = True
except ImportError:
available['firebase'] = False
try:
import openai
available['openai'] = True
except ImportError:
available['openai'] = False
return available
def run_demo():
"""Run the standalone demo"""
print("🚀 Running standalone demo...")
subprocess.run([sys.executable, "simple_demo.py"])
def run_basic_test():
"""Run basic web interface test"""
print("🌐 Starting basic web interface test...")
print("Installing minimal dependencies...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "flask", "python-dotenv"])
print("✅ Dependencies installed")
# Create basic .env if it doesn't exist
if not os.path.exists('.env'):
with open('.env', 'w') as f:
f.write("SECRET_KEY=test-secret-key-123\n")
print("✅ Created basic .env file")
print("\n🌐 Starting basic test server...")
print("Open your browser to: http://localhost:5000")
subprocess.run([sys.executable, "test_app_basic.py"])
except subprocess.CalledProcessError:
print("❌ Failed to install dependencies")
print("Try running: pip3 install flask python-dotenv")
def run_full_test():
"""Run full application test"""
print("🚀 Starting full application test...")
if not os.path.exists('.env'):
print("⚠️ No .env file found. Creating from template...")
if os.path.exists('.env.template'):
os.rename('.env.template', '.env')
print("✅ Created .env file from template")
print("📝 Please edit .env file with your API keys before running the full app")
return
else:
print("❌ No .env.template found. Please create .env file manually")
return
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("✅ All dependencies installed")
print("\n🚀 Starting full application...")
print("Open your browser to: http://localhost:5000")
subprocess.run([sys.executable, "app.py"])
except subprocess.CalledProcessError:
print("❌ Failed to install dependencies")
print("Try running: pip3 install -r requirements.txt")
def main():
print("🧠 MindCare Test Runner")
print("=" * 50)
# Check what's available
deps = check_dependencies()
print("📋 Available Testing Options:")
print()
print("1. 🚀 Standalone Demo (No setup required)")
print(" - Tests core mental health algorithms")
print(" - Shows sample analysis results")
print(" - No web interface")
print()
print("2. 🌐 Basic Web Test (Minimal setup)")
print(" - Full web interface")
print(" - In-memory database")
print(" - No external APIs required")
print()
print("3. 🌟 Full Application Test (Complete setup)")
print(" - All features enabled")
print(" - Firebase + OpenAI integration")
print(" - WhatsApp bot support")
print()
# Show current status
print("📊 Current Setup Status:")
print(f" Flask: {'✅' if deps['flask'] else '❌'}")
print(f" Firebase: {'✅' if deps['firebase'] else '❌'}")
print(f" OpenAI: {'✅' if deps['openai'] else '❌'}")
print(f" .env file: {'✅' if os.path.exists('.env') else '❌'}")
print()
while True:
choice = input("Choose testing option (1, 2, 3, or 'q' to quit): ").strip()
if choice == 'q':
print("👋 Goodbye!")
break
elif choice == '1':
run_demo()
break
elif choice == '2':
run_basic_test()
break
elif choice == '3':
run_full_test()
break
else:
print("❌ Invalid choice. Please enter 1, 2, 3, or 'q'")
if __name__ == "__main__":
main()