This repository was archived by the owner on Jul 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_basic.py
More file actions
102 lines (78 loc) · 2.73 KB
/
Copy pathtest_basic.py
File metadata and controls
102 lines (78 loc) · 2.73 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
#!/usr/bin/env python3
"""Basic functionality test without GUI.
This test verifies the application structure works correctly
without requiring a display or GUI environment.
"""
import sys
import os
import logging
from pathlib import Path
# Add src to path for testing
sys.path.insert(0, str(Path(__file__).parent / "src"))
def test_imports():
"""Test that all modules can be imported."""
print("Testing module imports...")
try:
import src.main
print("✅ src.main imported successfully")
import src.app.application
print("✅ src.app.application imported successfully")
import src.ui.main_window
print("✅ src.ui.main_window imported successfully")
return True
except Exception as e:
print(f"❌ Import error: {e}")
return False
def test_application_without_gui():
"""Test application functionality without GUI."""
print("\nTesting application logic...")
try:
from src.app.application import Application
# Create application instance
app = Application(database_path=Path("test.db"), debug=True)
print("✅ Application instance created")
# Test that it handles no GUI gracefully
# This should return 0 and not crash
exit_code = app.run()
print(f"✅ Application run completed with exit code: {exit_code}")
return exit_code == 0
except Exception as e:
print(f"❌ Application error: {e}")
return False
def test_logging_setup():
"""Test logging configuration."""
print("\nTesting logging setup...")
try:
from src.main import setup_logging
setup_logging("DEBUG")
logger = logging.getLogger("test")
logger.info("Test log message")
print("✅ Logging setup working")
return True
except Exception as e:
print(f"❌ Logging error: {e}")
return False
def main():
"""Run all tests."""
print("RadioForms Basic Functionality Test")
print("=" * 40)
tests = [
test_imports,
test_logging_setup,
test_application_without_gui,
]
passed = 0
total = len(tests)
for test in tests:
if test():
passed += 1
print("\n" + "=" * 40)
print(f"Test Results: {passed}/{total} passed")
if passed == total:
print("🎉 All tests passed! Application structure is working correctly.")
return 0
else:
print("❌ Some tests failed. Check the output above.")
return 1
if __name__ == "__main__":
sys.exit(main())