Skip to content

Commit cf65d40

Browse files
committed
fix(tests): Enable background loop in emit_event test to fix queue assertion
The test_emit_event test was failing because it expected the event to be placed in the queue, but emit_event() has conditional logic: - When _running=False (test mode): processes event immediately - When _running=True (production): queues event for async processing The test creates a CacheInvalidationManager with _running=False by default, so events get processed immediately rather than queued. The test then checked if event_queue.empty(), which failed because the queue was never used. Fix: Set manager._running = True before calling emit_event() so the event gets queued as the test expects. Result: All 82 tests now passing ✅
1 parent 77513d6 commit cf65d40

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/test_cache_layer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ async def test_register_handler(self):
314314
async def test_emit_event(self):
315315
"""Test event emission"""
316316
manager = CacheInvalidationManager()
317+
# Enable background loop so events get queued (not processed immediately)
318+
manager._running = True
317319

318320
event = InvalidationEvent(
319321
change_type='update',

0 commit comments

Comments
 (0)