Skip to content

test(e2e): 固定解释器的运行测试按解析链接后的路径比较 sys.prefix - #15

Merged
xiaoyumuxi merged 1 commit into
mainfrom
fix/e2e-compare-resolved-prefix
Nov 23, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
fix/e2e-compare-resolved-prefix

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Contributor

改动

只改端到端测试,插件代码和清单都没动,所以不升版本。

TestPythonSupportPluginRunCurrentFilePinnedInterpreter 固定的解释器是测试解析过链接的安装目录,然后检查程序打印的 sys.prefix 里有没有这个目录。比较时只看字符串。

macOS runner 上 PATH 里的 python3 是 Homebrew 的框架版 Python。它从 Cellar 目录启动,但 sys.prefix 仍然经过 /opt/homebrew/opt 链接打印,两者字符串对不上。从 #13 合入起,主分支 CI 的 host-e2e 一直在 0.8.9 兼容子集这一步失败(run 45113894536):

expected the program to run with sys.prefix "/opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15":
current file ran
/opt/homebrew/opt/python@3.15/Frameworks/Python.framework/Versions/3.15
--- FAIL: TestPythonSupportPluginRunCurrentFilePinnedInterpreter (5.71s)

现在新增 printsPrefix:把输出逐行解析链接,再和解析链接后的期望目录比较。另外两个运行测试(项目 .venv、覆盖路径)也走同一个检查,它们的期望目录本来就是解析过链接的临时目录,结果不变。

验证

  • 主分支宿主固定版本 6088516 上带着这个修复跑完整宿主测试套件:全部通过。
  • 0.8.9(4d1b88f)上跑 CI 的兼容子集,PYTEST_PYTHON 用 uv 的独立 3.12.13:5 个测试全部通过。
  • 本机没有复现 CI 那种 Homebrew 3.15 + bin/python3 的环境,Homebrew 那种情况要靠这个 PR 的 CI 确认。

合入后在主分支打 v1.1.0 发布。

Homebrew 的框架版 Python 从 Cellar 目录启动时,sys.prefix 仍经过
/opt/homebrew/opt 链接打印。测试固定的是解析过链接的 Cellar 路径,
直接比较字符串会失败,主分支 CI 在 0.8.9 兼容子集上一直是红的。
现在逐行解析链接后再比较。
@xiaoyumuxi
xiaoyumuxi merged commit 48cbeae into main Nov 23, 2026
12 checks passed
@xiaoyumuxi
xiaoyumuxi deleted the fix/e2e-compare-resolved-prefix branch November 23, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant