diff --git a/tests/base_rules/BUILD.bazel b/tests/base_rules/BUILD.bazel index cd5771533d..aa21042e25 100644 --- a/tests/base_rules/BUILD.bazel +++ b/tests/base_rules/BUILD.bazel @@ -11,70 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility -load("//tests/support:sh_py_run_test.bzl", "py_reconfig_test", "sh_py_run_test") - -_SUPPORTS_BOOTSTRAP_SCRIPT = select({ - "@platforms//os:windows": ["@platforms//:incompatible"], - "//conditions:default": [], -}) if IS_BAZEL_7_OR_HIGHER else ["@platforms//:incompatible"] - -sh_py_run_test( - name = "run_binary_zip_no_test", - build_python_zip = "no", - py_src = "bin.py", - sh_src = "run_binary_zip_no_test.sh", -) - -sh_py_run_test( - name = "run_binary_zip_yes_test", - build_python_zip = "yes", - py_src = "bin.py", - sh_src = "run_binary_zip_yes_test.sh", -) - -sh_py_run_test( - name = "run_binary_bootstrap_script_zip_yes_test", - bootstrap_impl = "script", - build_python_zip = "yes", - py_src = "bin.py", - sh_src = "run_binary_zip_yes_test.sh", - target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, -) - -sh_py_run_test( - name = "run_binary_bootstrap_script_zip_no_test", - bootstrap_impl = "script", - build_python_zip = "no", - py_src = "bin.py", - sh_src = "run_binary_zip_no_test.sh", - target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, -) - -py_reconfig_test( - name = "sys_path_order_bootstrap_script_test", - srcs = ["sys_path_order_test.py"], - bootstrap_impl = "script", - env = {"BOOTSTRAP": "script"}, - imports = ["./site-packages"], - main = "sys_path_order_test.py", - target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, -) - -py_reconfig_test( - name = "sys_path_order_bootstrap_system_python_test", - srcs = ["sys_path_order_test.py"], - bootstrap_impl = "system_python", - env = {"BOOTSTRAP": "system_python"}, - imports = ["./site-packages"], - main = "sys_path_order_test.py", -) - -sh_py_run_test( - name = "inherit_pythonsafepath_env_test", - bootstrap_impl = "script", - py_src = "bin.py", - sh_src = "inherit_pythonsafepath_env_test.sh", - target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, -) diff --git a/tests/bootstrap_impls/BUILD.bazel b/tests/bootstrap_impls/BUILD.bazel new file mode 100644 index 0000000000..cd5771533d --- /dev/null +++ b/tests/bootstrap_impls/BUILD.bazel @@ -0,0 +1,80 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility +load("//tests/support:sh_py_run_test.bzl", "py_reconfig_test", "sh_py_run_test") + +_SUPPORTS_BOOTSTRAP_SCRIPT = select({ + "@platforms//os:windows": ["@platforms//:incompatible"], + "//conditions:default": [], +}) if IS_BAZEL_7_OR_HIGHER else ["@platforms//:incompatible"] + +sh_py_run_test( + name = "run_binary_zip_no_test", + build_python_zip = "no", + py_src = "bin.py", + sh_src = "run_binary_zip_no_test.sh", +) + +sh_py_run_test( + name = "run_binary_zip_yes_test", + build_python_zip = "yes", + py_src = "bin.py", + sh_src = "run_binary_zip_yes_test.sh", +) + +sh_py_run_test( + name = "run_binary_bootstrap_script_zip_yes_test", + bootstrap_impl = "script", + build_python_zip = "yes", + py_src = "bin.py", + sh_src = "run_binary_zip_yes_test.sh", + target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, +) + +sh_py_run_test( + name = "run_binary_bootstrap_script_zip_no_test", + bootstrap_impl = "script", + build_python_zip = "no", + py_src = "bin.py", + sh_src = "run_binary_zip_no_test.sh", + target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, +) + +py_reconfig_test( + name = "sys_path_order_bootstrap_script_test", + srcs = ["sys_path_order_test.py"], + bootstrap_impl = "script", + env = {"BOOTSTRAP": "script"}, + imports = ["./site-packages"], + main = "sys_path_order_test.py", + target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, +) + +py_reconfig_test( + name = "sys_path_order_bootstrap_system_python_test", + srcs = ["sys_path_order_test.py"], + bootstrap_impl = "system_python", + env = {"BOOTSTRAP": "system_python"}, + imports = ["./site-packages"], + main = "sys_path_order_test.py", +) + +sh_py_run_test( + name = "inherit_pythonsafepath_env_test", + bootstrap_impl = "script", + py_src = "bin.py", + sh_src = "inherit_pythonsafepath_env_test.sh", + target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, +) diff --git a/tests/base_rules/bin.py b/tests/bootstrap_impls/bin.py similarity index 100% rename from tests/base_rules/bin.py rename to tests/bootstrap_impls/bin.py diff --git a/tests/base_rules/inherit_pythonsafepath_env_test.sh b/tests/bootstrap_impls/inherit_pythonsafepath_env_test.sh similarity index 100% rename from tests/base_rules/inherit_pythonsafepath_env_test.sh rename to tests/bootstrap_impls/inherit_pythonsafepath_env_test.sh diff --git a/tests/base_rules/run_binary_zip_no_test.sh b/tests/bootstrap_impls/run_binary_zip_no_test.sh similarity index 100% rename from tests/base_rules/run_binary_zip_no_test.sh rename to tests/bootstrap_impls/run_binary_zip_no_test.sh diff --git a/tests/base_rules/run_binary_zip_yes_test.sh b/tests/bootstrap_impls/run_binary_zip_yes_test.sh similarity index 100% rename from tests/base_rules/run_binary_zip_yes_test.sh rename to tests/bootstrap_impls/run_binary_zip_yes_test.sh diff --git a/tests/base_rules/run_zip_test.sh b/tests/bootstrap_impls/run_zip_test.sh similarity index 100% rename from tests/base_rules/run_zip_test.sh rename to tests/bootstrap_impls/run_zip_test.sh diff --git a/tests/base_rules/sys_path_order_test.py b/tests/bootstrap_impls/sys_path_order_test.py similarity index 100% rename from tests/base_rules/sys_path_order_test.py rename to tests/bootstrap_impls/sys_path_order_test.py