mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 16:07:01 +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:
@@ -31,10 +31,10 @@ def test_enabled_cleanup_skips_filesystem_detection():
|
||||
开关开启时应保持旧行为,且不产生额外文件系统检测。
|
||||
"""
|
||||
with patch(
|
||||
"app.chain.transfer.SystemUtils.is_network_filesystem"
|
||||
"app.chain._mixins.SystemUtils.is_network_filesystem"
|
||||
) as is_network_filesystem:
|
||||
should_delete = (
|
||||
TransferChain._TransferChain__should_delete_empty_source_directories(
|
||||
TransferChain._should_delete_empty_source_directories(
|
||||
_make_task(),
|
||||
True,
|
||||
{},
|
||||
@@ -50,11 +50,11 @@ def test_disabled_cleanup_keeps_mounted_local_source_directories():
|
||||
开关关闭时应保留网络或 FUSE 挂载的本地源目录。
|
||||
"""
|
||||
with patch(
|
||||
"app.chain.transfer.SystemUtils.is_network_filesystem",
|
||||
"app.chain._mixins.SystemUtils.is_network_filesystem",
|
||||
return_value=True,
|
||||
) as is_network_filesystem:
|
||||
should_delete = (
|
||||
TransferChain._TransferChain__should_delete_empty_source_directories(
|
||||
TransferChain._should_delete_empty_source_directories(
|
||||
_make_task(),
|
||||
False,
|
||||
{},
|
||||
@@ -72,11 +72,11 @@ def test_disabled_cleanup_still_deletes_ordinary_local_source_directories():
|
||||
开关关闭时普通本地文件系统仍应删除空目录。
|
||||
"""
|
||||
with patch(
|
||||
"app.chain.transfer.SystemUtils.is_network_filesystem",
|
||||
"app.chain._mixins.SystemUtils.is_network_filesystem",
|
||||
return_value=False,
|
||||
):
|
||||
should_delete = (
|
||||
TransferChain._TransferChain__should_delete_empty_source_directories(
|
||||
TransferChain._should_delete_empty_source_directories(
|
||||
_make_task(download_path="/downloads"),
|
||||
False,
|
||||
{},
|
||||
@@ -91,10 +91,10 @@ def test_disabled_cleanup_does_not_change_remote_storage_cleanup():
|
||||
开关关闭时非本地存储仍应执行原有空目录清理。
|
||||
"""
|
||||
with patch(
|
||||
"app.chain.transfer.SystemUtils.is_network_filesystem"
|
||||
"app.chain._mixins.SystemUtils.is_network_filesystem"
|
||||
) as is_network_filesystem:
|
||||
should_delete = (
|
||||
TransferChain._TransferChain__should_delete_empty_source_directories(
|
||||
TransferChain._should_delete_empty_source_directories(
|
||||
_make_task(storage="alist", download_path="/downloads"),
|
||||
False,
|
||||
{},
|
||||
@@ -111,12 +111,12 @@ def test_mounted_filesystem_detection_is_cached_by_source_directory():
|
||||
"""
|
||||
mounted_filesystem_cache = {}
|
||||
with patch(
|
||||
"app.chain.transfer.SystemUtils.is_network_filesystem",
|
||||
"app.chain._mixins.SystemUtils.is_network_filesystem",
|
||||
return_value=True,
|
||||
) as is_network_filesystem:
|
||||
for _ in range(2):
|
||||
should_delete = (
|
||||
TransferChain._TransferChain__should_delete_empty_source_directories(
|
||||
TransferChain._should_delete_empty_source_directories(
|
||||
_make_task(),
|
||||
False,
|
||||
mounted_filesystem_cache,
|
||||
|
||||
Reference in New Issue
Block a user