IJ selecting the incorrect Bazel target when debugging a Py test under transition #7196
Labels
awaiting-maintainer
Awaiting review from Bazel team on issues
product: IntelliJ
IntelliJ plugin
type: bug
Description of the bug:
See PR 7198.
Can't launch the debugger from the context menu
In a specific project that uses a pinned Python interpreter (internally using a transition) we see that the following query;
...brings up...
This query is done by the IJ plugin to understand the Rules in the repo.
Unfortunately when the user chooses to debug a Python file, the selected
py_test
target is:_test
and so the debugger fails to launch because the:_test
target is not a real one and you can't run it. A work-around is to keep going to the "Edit Configurations..." manually and modifying the label. This is tedious and difficult to communicate.The problem can be solved by making the IJ plugin choose the correct one and observe that
_transition_py_test
is actually apy_test
.Can't find sources for the right target
A further problem comes up around mapping the
//blah:test
back to the source in order to create a reverse mapping in the plugin from the source to the_transition_pt_test
target. This creates a situation where it appears that//blah:test
has no sources. Because it has no sources, it is never considered to be the target to debug for a given source file when the user opens the context-menu on the source file.I suspect that this happens because under Bazel 7 there is a mix of
PyInfo
from Bazel andPyInfo
fromrules_python
in play and thePyInfo
used differs between the:_test
and:test
targets. The templatedpython_info.bzl
is incorrectly assuming thatPyInfo
fromrules_python
is only coming into play on Bazel >8. Because the Python specific logic inintellij_info_impl.bzl
is unable to find the rightPyInfo
on the_transition_py_test
kind target, it never performs analysis on its sources.Which category does this issue belong to?
Intellij
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Please see the comment below for an example project which demonstrates the issue.
Which Intellij IDE are you using? Please provide the specific version.
Checks on UE 2024.1 and 2024.3
What programming languages and tools are you using? Please provide specific versions.
Python 3.10
What Bazel plugin version are you using?
2024.11.19.0.3-api-version-243
Have you found anything relevant by searching the web?
NA
Any other information, logs, or outputs that you want to share?
NA
The text was updated successfully, but these errors were encountered: