MCPcopy Create free account
hub / github.com/IBM/mcp-cli / _make_chat_context

Function _make_chat_context

tests/commands/memory/test_memory_command.py:24–53  ·  view source on GitHub ↗

Build a minimal mock chat_context.

(
    *,
    has_session: bool = False,
    has_vm: bool = False,
    has_store: bool = False,
    vm_budget: int = 128_000,
)

Source from the content-addressed store, hash-verified

22
23
24def _make_chat_context(
25 *,
26 has_session: bool = False,
27 has_vm: bool = False,
28 has_store: bool = False,
29 vm_budget: int = 128_000,
30) -> MagicMock:
31 """Build a minimal mock chat_context."""
32 ctx = MagicMock()
33 ctx._vm_budget = vm_budget
34 ctx._system_prompt_dirty = False
35
36 if has_vm:
37 vm = _make_vm()
38 session = MagicMock()
39 session.vm = vm
40 ctx.session = session
41 elif has_session:
42 session = MagicMock()
43 session.vm = None
44 ctx.session = session
45 else:
46 ctx.session = None
47
48 if has_store:
49 ctx.memory_store = _make_store()
50 else:
51 ctx.memory_store = None
52
53 return ctx
54
55
56def _make_vm() -> MagicMock:

Calls 2

_make_vmFunction · 0.85
_make_storeFunction · 0.70

Tested by

no test coverage detected