[feat] Add comprehensive unit tests for TaskQueue operations

- Add MockTaskQueue class with dependency injection for isolated testing
- Test core operations: queueing, processing, batch tracking, state management
- Test thread safety: concurrent access, worker lifecycle, exception handling
- Test integration workflows: full task processing with WebSocket updates
- Test edge cases: empty queues, invalid data, cleanup scenarios
- Solve heapq compatibility by wrapping items in priority tuples
- Include pytest configuration and test runner script
- All 15 tests passing with proper async/threading support

Testing covers:
 Task queueing with Pydantic validation
 Batch history tracking and persistence
 Thread-safe concurrent operations
 Worker thread lifecycle management
 WebSocket message delivery tracking
 State snapshots and error conditions
This commit is contained in:
bymyself
2025-06-13 21:12:11 -07:00
parent c888ea6435
commit 6e4b448b91
5 changed files with 655 additions and 0 deletions

1
tests/__init__.py Normal file
View File

@@ -0,0 +1 @@
"""Test suite for ComfyUI-Manager"""