EU-Utility/tests/run_tests.py

120 lines
3.0 KiB
Python

"""
EU-Utility Test Runner - Uses built-in unittest with pytest-compatible API
"""
import sys
import unittest
from pathlib import Path
# Add project root to path
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root))
# Import all test modules
from tests.unit.test_event_bus import *
from tests.unit.test_plugin_api import *
from tests.unit.test_data_store import *
from tests.unit.test_settings import *
from tests.unit.test_tasks import *
from tests.unit.test_nexus_api import *
from tests.unit.test_log_reader import *
# Additional test modules will be added here as they're created
def run_tests():
"""Run all tests and return results."""
# Create test suite
loader = unittest.TestLoader()
suite = unittest.TestSuite()
# Add all test classes
test_classes = [
# Event Bus Tests
TestEventBusSingleton,
TestEventPublishing,
TestEventSubscribing,
TestTypedSubscriptions,
TestEventHistory,
TestEventStatistics,
TestEventFilters,
TestEventDataClasses,
# Plugin API Tests
TestPluginAPISingleton,
TestAPIRegistration,
TestServiceRegistration,
TestSharedData,
TestUtilityFunctions,
TestLegacyEventSystem,
TestTypedEventIntegration,
# Data Store Tests
TestDataStoreSingleton,
TestDataStoreInitialization,
TestDataPersistence,
TestGetAllKeys,
TestClearPlugin,
TestBackupAndRestore,
TestCacheManagement,
TestFileNaming,
TestErrorHandling,
TestThreadSafety,
# Settings Tests
TestSettingsInitialization,
TestGetAndSet,
TestDefaultValues,
TestPluginManagement,
TestReset,
TestSignals,
TestSingleton,
# Task Manager Tests
TestTaskManagerSingleton,
TestTaskCreation,
TestTaskExecution,
TestTaskStatus,
TestDelayedTasks,
TestTaskCancellation,
TestActiveTasks,
TestSignals,
TestShutdown,
# Nexus API Tests
TestNexusAPISingleton,
TestEntityType,
TestNexusAPIConfiguration,
TestCaching,
TestSearchMethods,
TestItemDetails,
TestMarketData,
TestBatchMethods,
TestEntityDetails,
TestConvenienceFunctions,
TestAvailability,
# Log Reader Tests
TestLogReaderInitialization,
TestLogEvent,
TestPatternMatching,
TestSubscription,
TestReadLines,
TestStatistics,
TestAvailability,
TestStartStop,
]
for test_class in test_classes:
tests = loader.loadTestsFromTestCase(test_class)
suite.addTests(tests)
# Run tests
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
# Return exit code
return 0 if result.wasSuccessful() else 1
if __name__ == '__main__':
sys.exit(run_tests())