xref: /aosp_15_r20/external/bazelbuild-rules_python/tests/uv/toolchain/BUILD.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1load("//python:py_test.bzl", "py_test")
2load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED")  # buildifier: disable=bzl-visibility
3
4# We only test this feature when `bzlmod` is enabled.
5_TARGET_COMPATIBLE_WITH = [] if BZLMOD_ENABLED else ["@platforms//:incompatible"]
6
7genrule(
8    name = "uv_help",
9    outs = ["uv_help.txt"],
10    cmd = "$(UV_BIN) --python-fetch manual --help >$@",
11    target_compatible_with = _TARGET_COMPATIBLE_WITH,
12    toolchains = ["//python/uv:current_toolchain"],
13)
14
15py_test(
16    name = "uv_help_test",
17    srcs = ["uv_help_test.py"],
18    data = [":uv_help"],
19    env = {"DATA": "$(rlocationpath :uv_help)"},
20    target_compatible_with = _TARGET_COMPATIBLE_WITH,
21    deps = ["//python/runfiles"],
22)
23