bazel-contrib / bazel-contrib/rules_python

Exec py_test targets in a way that would work with --run_under=lldb

未关闭
#2,104 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Starlark
星标
688
派生
721
平均合并
15 小时 7 分钟
30 天内合并 PR
76

描述

# 🚀 feature request

### Description

When you're debugging python targets that load python C extensions, it can be useful in general to run something like `lldb -- python3 -m pytest path/to/tests`. In bazel I would envision this as `bazel test --run_under=lldb :tests`, but this doesn't work currently since py_test execs a script with a shebang. I think in theory if py_test ran the equivalent of `python3 path/to/script` it could "just work" but I'm not sure.

### Describe alternatives you've considered

You can try to catch the process by launching the debugger elsewhere like `lldb --wait-for -n python3.11`, but this is a bit fragile since you could catch the wrong process

贡献指南

打开贡献指南

调研方向

从 py_test 的执行路径开始,跟踪 `bazel test --run_under=lldb :tests` 如何调用生成的测试脚本。将当前基于 shebang 的执行方式与所要求的 `python3 path/to/script` 行为进行比较,然后验证 Python C-extension 测试是否能在 LLDB 下启动,同时普通的 py_test 执行保持不变。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
build-system, testing
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。