itsluckysharma01 commited on
Commit
3ebfa1f
Β·
1 Parent(s): 7a39572

delete file

Browse files
Files changed (1) hide show
  1. test_app_portability.py +0 -78
test_app_portability.py DELETED
@@ -1,78 +0,0 @@
1
- """
2
- Test script to verify app.py portability logic
3
- Simulates app.py being in different locations
4
- """
5
-
6
- from pathlib import Path
7
- import sys
8
-
9
- def test_portability_logic(app_location):
10
- """Test the portability logic as if app.py was at app_location"""
11
-
12
- # Simulate app.py's __file__ being at app_location
13
- print(f"\nπŸ“ Testing with app.py at: {app_location}")
14
- print("-" * 60)
15
-
16
- # This is the exact logic from app.py
17
- webapp_parent = app_location.parent.parent
18
- if (webapp_parent / 'config').exists():
19
- PROJECT_ROOT = webapp_parent
20
- location_type = "Original location (webapp/)"
21
- else:
22
- # app.py was moved - find project root by searching for config/
23
- PROJECT_ROOT = app_location.parent
24
- while PROJECT_ROOT != PROJECT_ROOT.parent: # Until root of filesystem
25
- if (PROJECT_ROOT / 'config').exists() and (PROJECT_ROOT / 'src').exists():
26
- break
27
- PROJECT_ROOT = PROJECT_ROOT.parent
28
- location_type = "Moved location (outside webapp/)"
29
-
30
- # Determine webapp folder (for templates/static/uploads)
31
- WEBAPP_FOLDER = PROJECT_ROOT / 'webapp'
32
-
33
- # Print results
34
- print(f"Location type: {location_type}")
35
- print(f"PROJECT_ROOT: {PROJECT_ROOT}")
36
- print(f"WEBAPP_FOLDER: {WEBAPP_FOLDER}")
37
-
38
- # Verify all required folders exist
39
- required_folders = ['config', 'src', 'webapp', 'ai_models', 'docs']
40
- all_exist = True
41
- print(f"\nRequired folders check:")
42
- for folder in required_folders:
43
- exists = (PROJECT_ROOT / folder).exists()
44
- status = "βœ“" if exists else "βœ—"
45
- print(f" {status} {folder}")
46
- all_exist = all_exist and exists
47
-
48
- # Check template and static folders
49
- print(f"\nFlask folders check:")
50
- templates_exist = (WEBAPP_FOLDER / 'templates').exists()
51
- static_exist = (WEBAPP_FOLDER / 'static').exists()
52
- print(f" {'βœ“' if templates_exist else 'βœ—'} templates/")
53
- print(f" {'βœ“' if static_exist else 'βœ—'} static/")
54
-
55
- return all_exist and templates_exist and static_exist
56
-
57
- # Test 1: Original location (webapp/app.py)
58
- project_root = Path(__file__).parent
59
- result1 = test_portability_logic(project_root / 'webapp' / 'app.py')
60
-
61
- # Test 2: Moved to project root (app.py)
62
- result2 = test_portability_logic(project_root / 'app.py')
63
-
64
- # Test 3: Moved to src (src/app.py)
65
- result3 = test_portability_logic(project_root / 'src' / 'app.py')
66
-
67
- # Summary
68
- print("\n" + "=" * 60)
69
- print("PORTABILITY TEST SUMMARY")
70
- print("=" * 60)
71
- print(f"βœ“ Original location (webapp/app.py): {'PASS' if result1 else 'FAIL'}")
72
- print(f"{'βœ“' if result2 else 'βœ—'} Moved to root (app.py): {'PASS' if result2 else 'FAIL'}")
73
- print(f"{'βœ“' if result3 else 'βœ—'} Moved to src (src/app.py): {'PASS' if result3 else 'FAIL'}")
74
-
75
- if result1 and result2 and result3:
76
- print("\nβœ… app.py IS PORTABLE - Can be used anywhere in the project!")
77
- else:
78
- print("\n❌ app.py is NOT fully portable")