fix(test): update test_ai_loop_regressions_20260614 to patch provider_state.get_history
The Phase 7 alias removal exposed a pre-existing test that patched src.ai_client._minimax_history and src.ai_client._minimax_history_lock. Those aliases no longer exist (deleted in Phase 7). Update the test to patch src.provider_state.get_history with a side_effect that returns a fresh empty ProviderHistory for 'minimax' and passes through other providers. This is the canonical pattern for tests that need to intercept the new provider_state.get_history(...) calls.
This commit is contained in:
@@ -212,16 +212,19 @@ def test_fr3_minimax_thinking_in_returned_text() -> None:
|
||||
))
|
||||
|
||||
from src import openai_compatible as oc
|
||||
from src import provider_state
|
||||
from src.provider_state import ProviderHistory
|
||||
from src.vendor_capabilities import register, VendorCapabilities
|
||||
register(VendorCapabilities(vendor="minimax", model="MiniMax-M2.7", reasoning=True))
|
||||
ai_client._model = "MiniMax-M2.7"
|
||||
|
||||
empty_minimax = ProviderHistory()
|
||||
|
||||
with patch.object(oc, "send_openai_compatible", side_effect=_fake_send_openai_compatible), \
|
||||
patch("src.ai_client._ensure_minimax_client", return_value=MagicMock()), \
|
||||
patch("src.ai_client._get_deepseek_tools", return_value=[]), \
|
||||
patch("src.ai_client._trim_minimax_history", side_effect=lambda msgs, h: None), \
|
||||
patch("src.ai_client._minimax_history", new=[]), \
|
||||
patch("src.ai_client._minimax_history_lock", new=MagicMock()):
|
||||
patch("src.provider_state.get_history", side_effect=lambda p: empty_minimax if p == "minimax" else provider_state._PROVIDER_HISTORIES[p]):
|
||||
result = ai_client._send_minimax("system", "user", ".", None, "", False, None, None, None)
|
||||
|
||||
assert isinstance(result, Result), f"_send_minimax must return a Result, got {type(result).__name__}"
|
||||
|
||||
Reference in New Issue
Block a user