fix(pybot): Windows 测试环境兼容(scripts 软链解析、os.pathsep 分隔)
- conftest:pybot/scripts 为 git 符号链接,Windows 落盘为文本文件(内容=目标相对路径),测试时手动解析到 bot4cj/scripts - plugin:PYBOT_MODULES_PATH 改按 os.pathsep 分隔,避免 Windows 盘符冒号被切碎导致 find_module 返回丢盘符的路径
This commit is contained in:
1 parent
a2ba797410
commit
b289e7d17c
2 files changed
+4
-1
No files matched your search
@@ -52,7 +52,7 @@ def search_dirs():
|
||||
"""插件搜索目录(按优先级):$PYBOT_MODULES_PATH → 包内置 → cwd"""
|
||||
dirs = []
|
||||
env = os.environ.get("PYBOT_MODULES_PATH", "")
|
||||
for p in env.split(":"):
|
||||
for p in env.split(os.pathsep):
|
||||
if p:
|
||||
dirs.append(Path(p))
|
||||
dirs.append(Path(__file__).resolve().parent.parent / "modules") # 包内置
|
||||
|
||||
@@ -12,6 +12,9 @@ from pybot.hd import i2c, spi # noqa: E402
|
||||
|
||||
|
||||
SCRIPTS_DIR = ROOT / "scripts"
|
||||
if not SCRIPTS_DIR.is_dir():
|
||||
# Windows:git 符号链接落盘为文本文件(内容 = 目标相对路径),手动解析
|
||||
SCRIPTS_DIR = (ROOT / SCRIPTS_DIR.read_text().strip()).resolve()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
||||
Reference in new issue
Block a user