aspect-build / rules_py

More compatible Bazel rules for running Python tools and building Python projects
Apache License 2.0
86 stars 29 forks source link

[Bug]: `py_test` macro doesn't propagate `target_compatible_with` to `_py_venv` when building targets #437

Open RoyShulman opened 2 weeks ago

RoyShulman commented 2 weeks ago

What happened?

I was running bazel cquery --skip_incompatible_explicit_targets in my project which uses the py_test macro from this repository. In my project I have a target which has the target_compatible_with set to "platforms//os:linux and since I am running on mac I would expect bazel to skip this target, and it does when I use the macro from bazelbuild/rules_python. When I change to the macro from this repository it fails. I tried to debug the issue and saw that if I add the attribute here everything works.

Version

Development (host) and target OS/architectures:

Output of bazel --version: bazel 7.4.0rc4

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file: 1.0.0-rc0

Language(s) and/or frameworks involved: python

How to reproduce

Create a target that is only compatible with a specific platform, and try to run it on a different platform

Any other information?

No response