From 6405ff1191ee3cb82c1c75414f8d7d59454186ae Mon Sep 17 00:00:00 2001 From: InfinityPacer <160988576+InfinityPacer@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:50:55 +0800 Subject: [PATCH] test: split agenttokens plugin test out, un-skip agent event tests (#5885) --- tests/test_agent_tokens_events.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/tests/test_agent_tokens_events.py b/tests/test_agent_tokens_events.py index 89b567f5..6462def4 100644 --- a/tests/test_agent_tokens_events.py +++ b/tests/test_agent_tokens_events.py @@ -2,14 +2,10 @@ import unittest from types import SimpleNamespace from unittest.mock import AsyncMock, patch -import pytest from langchain_core.messages import AIMessage from app.agent import MoviePilotAgent from app.agent.memory import memory_manager -# agenttokens 为动态安装插件(app/plugins/** 被 gitignore,CI / 全新环境无此插件), -# 缺失时跳过本模块,避免 collection 阶段 ImportError。 -AgentTokens = pytest.importorskip("app.plugins.agenttokens").AgentTokens from app.schemas.types import ChainEventType, EventType @@ -44,31 +40,6 @@ class _FakeFailingAgent(_FakeAgent): class AgentTokensEventsTest(unittest.IsolatedAsyncioTestCase): - async def test_plugin_sidebar_nav_respects_config(self): - """插件侧边栏入口应受 show_sidebar_nav 配置控制。""" - plugin = AgentTokens() - - with patch.object(plugin, "update_config"): - plugin.init_plugin( - { - "enabled": True, - "show_sidebar_nav": False, - "providers": [], - } - ) - self.assertEqual([], plugin.get_sidebar_nav()) - - plugin.init_plugin( - { - "enabled": True, - "show_sidebar_nav": True, - "providers": [], - } - ) - nav = plugin.get_sidebar_nav() - - self.assertEqual("Agent Tokens 管理", nav[0]["title"]) - async def test_initialize_llm_uses_chain_event_selection(self): """Agent 初始化 LLM 时应优先使用链式事件返回的供应商配置。""" agent = MoviePilotAgent(session_id="agent-tokens-test", user_id="user-1")