Merge PR #130 (feat #62-67 模板配置台全链路:RBAC/点位导入/配置/预览/发布推送 + #55 Ti 布局模板改进)

This commit is contained in:
2026-08-05 08:27:01 +08:00
parent 52d986e6f0
commit 6036e5e151
17 changed files with 3243 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""测试引导:把 `core/template-console` 以包名 `template_console` 挂载到 sys.modules。
目录名 `template-console` 含连字符,无法直接以包名 import;挂载后模块内
相对导入(`from .rbac import ...`)在 unittest 发现机制下可正常解析。
同时把兄弟内核目录 `core/edge-gateway` 加入 sys.path,使 point_importer
可复用其 `point_dict` 子包(loader/validator/schema),避免重复造轮子。
"""
import os
import sys
import types
# 1) 挂载 core/template-console 为 template_console 包
CONSOLE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, CONSOLE_DIR)
if "template_console" not in sys.modules:
pkg = types.ModuleType("template_console")
pkg.__path__ = [CONSOLE_DIR]
sys.modules["template_console"] = pkg
# 2) 暴露兄弟内核 edge-gateway/point_dict(#63 复用其校验器)
CORE_DIR = os.path.dirname(CONSOLE_DIR)
EDGE_GW_DIR = os.path.join(CORE_DIR, "edge-gateway")
if os.path.isdir(EDGE_GW_DIR) and EDGE_GW_DIR not in sys.path:
sys.path.insert(0, EDGE_GW_DIR)