-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_test.py
More file actions
95 lines (81 loc) · 2.72 KB
/
Copy pathsimple_test.py
File metadata and controls
95 lines (81 loc) · 2.72 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
#!/usr/bin/env python3
"""Simple test to verify the basic structure works"""
import os
import sys
def test_file_structure():
"""Test if all required files exist"""
required_files = [
'app/__init__.py',
'app/config.py',
'app/routes.py',
'app/socket_events.py',
'app/templates/index.html',
'app/templates/error.html',
'app/static/chat.js',
'app/static/styles.css',
'requirements.txt',
'run.py'
]
print("🔍 Checking file structure...")
missing_files = []
for file_path in required_files:
if os.path.exists(file_path):
print(f"✅ {file_path}")
else:
print(f"❌ {file_path}")
missing_files.append(file_path)
if missing_files:
print(f"\n❌ Missing {len(missing_files)} files:")
for file in missing_files:
print(f" - {file}")
return False
else:
print(f"\n🎉 All {len(required_files)} required files are present!")
return True
def test_syntax():
"""Test if Python files have valid syntax"""
python_files = [
'app/__init__.py',
'app/config.py',
'app/routes.py',
'app/socket_events.py',
'run.py'
]
print("\n🔍 Checking Python syntax...")
syntax_errors = []
for file_path in python_files:
try:
with open(file_path, 'r', encoding='utf-8') as f:
compile(f.read(), file_path, 'exec')
print(f"✅ {file_path}")
except SyntaxError as e:
print(f"❌ {file_path}: {e}")
syntax_errors.append((file_path, str(e)))
except Exception as e:
print(f"⚠️ {file_path}: {e}")
if syntax_errors:
print(f"\n❌ Found {len(syntax_errors)} syntax errors:")
for file, error in syntax_errors:
print(f" - {file}: {error}")
return False
else:
print(f"\n🎉 All Python files have valid syntax!")
return True
def main():
print("🚀 ChatterPy - Structure & Syntax Test")
print("=" * 50)
structure_ok = test_file_structure()
syntax_ok = test_syntax()
print("\n" + "=" * 50)
if structure_ok and syntax_ok:
print("🎉 All tests passed! Your ChatterPy app is ready.")
print("\nNext steps:")
print("1. Install dependencies: pip install -r requirements.txt")
print("2. Run the app: python run.py")
print("3. Open http://localhost:5000 in your browser")
else:
print("❌ Some tests failed. Please fix the issues above.")
return structure_ok and syntax_ok
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)