bazel-contrib / bazel-contrib/rules_python

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

Open
#2,104 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
688
Forks
721
Avg merge
15h 7m
Merged PRs (30d)
76

Description

# 🚀 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.