fix(test): enable memory config in test_memory_queue_user_isolation

The queue.add() method early-returns when config.memory.enabled is false.
With the refactored AppConfig.current() default, memory is disabled, so
these tests have to mock it explicitly.
This commit is contained in:
greatmengqi 2026-04-16 11:22:00 +08:00
parent 4df595b033
commit e7bb1e9c54

View File

@ -1,7 +1,19 @@
"""Tests for user_id propagation through memory queue."""
from unittest.mock import MagicMock, patch
import pytest
from deerflow.agents.memory.queue import ConversationContext, MemoryUpdateQueue
from deerflow.config.app_config import AppConfig
from deerflow.config.memory_config import MemoryConfig
@pytest.fixture(autouse=True)
def _enable_memory(monkeypatch):
"""Ensure MemoryUpdateQueue.add() doesn't early-return on disabled memory."""
config = MagicMock(spec=AppConfig)
config.memory = MemoryConfig(enabled=True)
monkeypatch.setattr(AppConfig, "current", staticmethod(lambda: config))
def test_conversation_context_has_user_id():