What happened?
When using exec_properties with Bazel select() statements in py_test rules, the build fails with:
Error: 'select' value has no field or method 'items'
Version
- rules_py version: v1.4.0+ (all versions since the fix)
- Bazel version: Any
- OS: Any
How to reproduce
Minimal reproduction:
py_test(
name = "my_test",
srcs = ["test.py"],
exec_properties = select({
"//conditions:default": {"key": "value"},
}),
)
Any other information?
I believe this was introduced via commit 84f17d3 (PR #529) which was first released in v1.4.0
In https://github.com/aspect-build/rules_py/blob/main/py/defs.bzl#L67, the code assumes exec_properties is always a dict:
non_test_exec_properties = {k: v for k, v in exec_properties.items() if not k.startswith("test.")}