refactor(fudai): 抽 __init__ 配置默认值到 init_helpers (1559 → 1323)
fudai_analyse.__init__ L119-354 是 236 行配置字段默认值 + 运行时状态初始化: - ~80 个 self.X = <default_value> 配置字段 - 30+ 个运行时状态字段 - _reservations_state_path 解析 + room_pos_map 旧文件清理 抽到 douyin/core/fudai_modules/init_helpers.py: - apply_fudai_defaults(self): 主入口 - _apply_yanghao_defaults(self): 推荐页养号子段 - _resolve_reservations_state_path(self): 解析路径,path_config 失败时 兜底用 ".." 回退(不再用 dirname(__file__) + "state") - _cleanup_old_room_pos_map_files(self): 清理上次运行的 JSON/CSV/MD 导出 __init__ 中保留: - L57-117 设备/分辨率/operation/日志系统初始化(依赖较深,难抽) - L356-357 self.load_config() 行为完全保留:所有字段值、解析顺序、异常兜底全部不变。 test_runtime_path_anchors.test_reservations_state_path_uses_path_config 已更新 为同时检查 douyin_fudai.py 和 init_helpers.py。 1361 passed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3a9f01ad74
commit
a864f6e23a
3 files changed
+231
-239
No files matched your search
@@ -80,9 +80,17 @@ class TestDouyinFudaiPaths:
|
||||
assert "path_config" in src and "get_actions_log_path()" in src
|
||||
|
||||
def test_reservations_state_path_uses_path_config(self):
|
||||
"""reservations.json 必须用 path_config(兜底也保留,但首选 path_config)。"""
|
||||
src = _read("douyin", "core", "douyin_fudai.py")
|
||||
assert "get_reservations_path()" in src
|
||||
"""reservations.json 必须用 path_config(兜底也保留,但首选 path_config)。
|
||||
|
||||
路径解析逻辑已抽到 fudai_modules/init_helpers.py 的
|
||||
_resolve_reservations_state_path,所以两个文件任一处都算通过。
|
||||
"""
|
||||
sources = [
|
||||
_read("douyin", "core", "douyin_fudai.py"),
|
||||
_read("douyin", "core", "fudai_modules", "init_helpers.py"),
|
||||
]
|
||||
combined = "\n".join(sources)
|
||||
assert "get_reservations_path()" in combined
|
||||
|
||||
def test_actions_log_no_naive_dirname_pattern(self):
|
||||
"""actions.log 兜底分支必须用 ".." 回到项目根,不能再裸拼 'logs/actions.log'。"""
|
||||
|
||||
Reference in new issue
Block a user