Add comprehensive model tests
- Add tests for all model CRUD operations - Add test for base Model class - Add test runner for all model tests - Tests include cleanup and validation
This commit is contained in:
60
tests/models/run_all.py
Normal file
60
tests/models/run_all.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""Run all model tests."""
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add src to path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../src'))
|
||||
|
||||
from test_model import test_model
|
||||
from test_preset import test_preset
|
||||
from test_profile import test_profile
|
||||
from test_group import test_group
|
||||
from test_sequence import test_sequence
|
||||
from test_tab import test_tab
|
||||
from test_palette import test_palette
|
||||
|
||||
def run_all_tests():
|
||||
"""Run all model tests."""
|
||||
print("=" * 60)
|
||||
print("Running Model Tests")
|
||||
print("=" * 60)
|
||||
|
||||
tests = [
|
||||
("Base Model", test_model),
|
||||
("Preset", test_preset),
|
||||
("Profile", test_profile),
|
||||
("Group", test_group),
|
||||
("Sequence", test_sequence),
|
||||
("Tab", test_tab),
|
||||
("Palette", test_palette),
|
||||
]
|
||||
|
||||
passed = 0
|
||||
failed = 0
|
||||
|
||||
for name, test_func in tests:
|
||||
print(f"\n{'=' * 60}")
|
||||
print(f"Testing {name}")
|
||||
print('=' * 60)
|
||||
try:
|
||||
test_func()
|
||||
print(f"\n✓ {name} tests passed!")
|
||||
passed += 1
|
||||
except AssertionError as e:
|
||||
print(f"\n✗ {name} tests failed: {e}")
|
||||
failed += 1
|
||||
except Exception as e:
|
||||
print(f"\n✗ {name} tests error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
failed += 1
|
||||
|
||||
print(f"\n{'=' * 60}")
|
||||
print(f"Test Summary: {passed} passed, {failed} failed")
|
||||
print('=' * 60)
|
||||
|
||||
return failed == 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
success = run_all_tests()
|
||||
sys.exit(0 if success else 1)
|
||||
Reference in New Issue
Block a user