Skip to content

tests: Force analysis test labels to resolve within @rules_python context #1187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tools/build_defs/python/tests/py_test/py_test_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ load(
)
load("//tools/build_defs/python/tests:util.bzl", pt_util = "util")

# Explicit Label() calls are required so that it resolves in @rules_python context instead of
# @rules_testing context.
_FAKE_CC_TOOLCHAIN = Label("//tools/build_defs/python/tests:cc_toolchain_suite")
_PLATFORM_MAC = Label("//tools/build_defs/python/tests:mac")
_PLATFORM_LINUX = Label("//tools/build_defs/python/tests:linux")

_tests = []

def _test_mac_requires_darwin_for_execution(name, config):
Expand All @@ -44,8 +50,8 @@ def _test_mac_requires_darwin_for_execution(name, config):
target = name + "_subject",
config_settings = {
"//command_line_option:cpu": "darwin_x86_64",
"//command_line_option:crosstool_top": "@rules_python//tools/build_defs/python/tests:cc_toolchain_suite",
"//command_line_option:platforms": "@rules_python//tools/build_defs/python/tests:mac",
"//command_line_option:crosstool_top": _FAKE_CC_TOOLCHAIN,
"//command_line_option:platforms": [_PLATFORM_MAC],
},
)

Expand Down Expand Up @@ -75,8 +81,8 @@ def _test_non_mac_doesnt_require_darwin_for_execution(name, config):
target = name + "_subject",
config_settings = {
"//command_line_option:cpu": "k8",
"//command_line_option:crosstool_top": "@rules_python//tools/build_defs/python/tests:cc_toolchain_suite",
"//command_line_option:platforms": "@rules_python//tools/build_defs/python/tests:linux",
"//command_line_option:crosstool_top": _FAKE_CC_TOOLCHAIN,
"//command_line_option:platforms": [_PLATFORM_LINUX],
},
)

Expand Down