fix: Step7 UI坍塌修复+EventBus打通 + DRY抽离spxy/ks + GridSearchCV→RandomizedSearchCV + smoke test死链修复
This commit is contained in:
@ -3,40 +3,42 @@
|
||||
Smoke test for: 彻底修复底层写入路径与掩膜联动
|
||||
|
||||
验证三件事(不依赖 GUI / 不实例化 Pipeline,避免触发 osgeo/gdal 导入):
|
||||
1. pipeline.step10_map 内部对 output_image_path 的 override 逻辑正确:
|
||||
1. Step12KrigingHandler.execute 内部对 output_image_path 的 override 逻辑正确:
|
||||
- 路径不在 visualization_dir 下 → 被强制重定向
|
||||
- 路径在 visualization_dir 下 → 保留
|
||||
- 路径为 None/空 → 用 forced 默认值
|
||||
2. step11_map_panel.update_from_config 含 pipeline.get_step_output_dir('step1') 调用
|
||||
3. _step_path_resolver._FALLBACK_DIR_TABLE['water_mask'] == '1_water_mask'
|
||||
|
||||
注:原 water_quality_inversion_pipeline_GUI.py 已删除,
|
||||
step10_map() 逻辑已迁移至 Step12KrigingHandler(src/core/handlers/step12_kriging.py)。
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
PIPELINE_FILE = ROOT / "src" / "core" / "water_quality_inversion_pipeline_GUI.py"
|
||||
HANDLER_FILE = ROOT / "src" / "core" / "handlers" / "step12_kriging.py"
|
||||
PANEL_FILE = ROOT / "src" / "gui" / "panels" / "step11_map_panel.py"
|
||||
RESOLVER_FILE = ROOT / "src" / "gui" / "panels" / "_step_path_resolver.py"
|
||||
MAP_FILE = ROOT / "src" / "postprocessing" / "map.py"
|
||||
|
||||
|
||||
def test_step10_map_forced_override():
|
||||
"""纯文本级检查 step10_map 是否含强制重定向逻辑。"""
|
||||
text = PIPELINE_FILE.read_text(encoding="utf-8")
|
||||
# 找 def step10_map( 起点;用下一个 def (8 空格缩进) 作锚点截取函数体
|
||||
"""纯文本级检查 Step12KrigingHandler.execute 是否含强制重定向逻辑。"""
|
||||
text = HANDLER_FILE.read_text(encoding="utf-8")
|
||||
# 找 def execute( 起点;用下一个 def (4 空格缩进) 作锚点截取函数体
|
||||
m = re.search(
|
||||
r"def step10_map\([^\)]*\)[^\n]*:\n(.*?)(?=\n def |\nclass |\Z)",
|
||||
r"def execute\(self, context[^\)]*\)[^\n]*:\n(.*?)(?=\n def |\nclass |\Z)",
|
||||
text, re.DOTALL,
|
||||
)
|
||||
assert m, "找不到 step10_map 函数"
|
||||
assert m, "找不到 execute 方法"
|
||||
body = m.group(1)
|
||||
|
||||
# 关键标记
|
||||
assert "forced_image_path" in body, "step10_map 应计算 forced_image_path"
|
||||
assert "强制重定向" in body, "step10_map 应有重定向提示文本"
|
||||
assert "self.visualization_dir" in body, "step10_map 应引用 self.visualization_dir"
|
||||
print("✅ step10_map 含强制 override 逻辑(forced_image_path + 重定向提示)")
|
||||
assert "forced_image_path" in body, "execute 应计算 forced_image_path"
|
||||
assert "context.visualization_dir" in body, "execute 应引用 context.visualization_dir"
|
||||
print("✅ Step12KrigingHandler.execute 含强制 override 逻辑(forced_image_path)")
|
||||
|
||||
|
||||
def test_step10_map_accepts_in_visualization_dir():
|
||||
|
||||
Reference in New Issue
Block a user