mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-07 08:26:53 +08:00
refactor(chain): 处理链功能域 mixin 化,清理未使用导入并根治兼容层循环导入
- ChainBase 拆分为 RecognitionMixin/MessageProcessingMixin/NotificationMixin - TransferChain 拆分为 7 个功能 mixin(_mixins.py),SubscribeChain 音乐订阅域拆出 _music.py - 斜杠命令交互四件套收敛为 InteractionChainMixin 委托,会话管理器移至 application 层,chain 层不再 re-export - 模块基础类收敛到 app/modules/_base(notification/mediaserver 语义重命名) - 清理 app/chain/__init__.py 24 个未使用导入,修正 49 处测试 patch 目标到实际命名空间 - 兼容层 legacy 符号不再并入 __all__,根治 schemas 初始化反向拉起 application.transfer 的循环导入 - 修复 bangumi 集数为字符串时 set_bangumi_info 抛 TypeError - 新增重复代码等架构门禁测试;capability 清单校验排除下划线内部目录
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
"""
|
||||
from types import SimpleNamespace
|
||||
|
||||
import app.chain.transfer as transfer_module
|
||||
import app.chain._mixins as mixins_module
|
||||
from app.chain.transfer import TransferChain
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ def test_transfer_prefers_snapshot_over_live_lookup(monkeypatch):
|
||||
called["lookup"] = True
|
||||
return SimpleNamespace(custom_words="不应使用\n实时反查")
|
||||
|
||||
monkeypatch.setattr(transfer_module, "SubscribeChain", _GuardSubscribeChain)
|
||||
monkeypatch.setattr(mixins_module, "SubscribeChain", _GuardSubscribeChain)
|
||||
|
||||
history = _fake_history(
|
||||
custom_words="S04 => S01\n第 <> 集 >> EP+66",
|
||||
@@ -46,7 +46,7 @@ def test_transfer_falls_back_to_live_lookup_without_snapshot(monkeypatch):
|
||||
assert source == "Subscribe|{...}"
|
||||
return SimpleNamespace(custom_words="A => B")
|
||||
|
||||
monkeypatch.setattr(transfer_module, "SubscribeChain", _FakeSubscribeChain)
|
||||
monkeypatch.setattr(mixins_module, "SubscribeChain", _FakeSubscribeChain)
|
||||
|
||||
history = _fake_history(custom_words=None, note={"source": "Subscribe|{...}"})
|
||||
result = TransferChain._get_subscribe_custom_words(history)
|
||||
@@ -61,7 +61,7 @@ def test_transfer_returns_none_when_unavailable(monkeypatch):
|
||||
def get_subscribe_by_source(self, source):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr(transfer_module, "SubscribeChain", _NoneSubscribeChain)
|
||||
monkeypatch.setattr(mixins_module, "SubscribeChain", _NoneSubscribeChain)
|
||||
|
||||
# 无下载记录
|
||||
assert TransferChain._get_subscribe_custom_words(None) is None
|
||||
|
||||
Reference in New Issue
Block a user