Fixed glob includes for ignore_root_user_error (#1037)
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index a400360..76f9d8b 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml
@@ -273,3 +273,24 @@ name: pip_repository_entry_points integration tests on Windows working_directory: tests/pip_repository_entry_points platform: windows + + integration_test_ignore_root_user_error_ubuntu: + <<: *reusable_build_test_all + name: ignore_root_user_error integration tests on Ubuntu + working_directory: tests/ignore_root_user_error + platform: ubuntu2004 + integration_test_ignore_root_user_error_debian: + <<: *reusable_build_test_all + name: ignore_root_user_error integration tests on Debian + working_directory: tests/ignore_root_user_error + platform: debian11 + integration_test_ignore_root_user_error_macos: + <<: *reusable_build_test_all + name: ignore_root_user_error integration tests on macOS + working_directory: tests/ignore_root_user_error + platform: macos + integration_test_ignore_root_user_error_windows: + <<: *reusable_build_test_all + name: ignore_root_user_error integration tests on Windows + working_directory: tests/ignore_root_user_error + platform: windows
diff --git a/tests/ignore_root_user_error/.bazelrc b/tests/ignore_root_user_error/.bazelrc new file mode 100644 index 0000000..f23315a --- /dev/null +++ b/tests/ignore_root_user_error/.bazelrc
@@ -0,0 +1,5 @@ +test --test_output=errors + +# Windows requires these for multi-python support: +build --enable_runfiles +startup --windows_enable_symlinks
diff --git a/tests/ignore_root_user_error/.gitignore b/tests/ignore_root_user_error/.gitignore new file mode 100644 index 0000000..ac51a05 --- /dev/null +++ b/tests/ignore_root_user_error/.gitignore
@@ -0,0 +1 @@ +bazel-*
diff --git a/tests/ignore_root_user_error/BUILD.bazel b/tests/ignore_root_user_error/BUILD.bazel new file mode 100644 index 0000000..f907624 --- /dev/null +++ b/tests/ignore_root_user_error/BUILD.bazel
@@ -0,0 +1,7 @@ +load("@rules_python//python:defs.bzl", "py_test") + +py_test( + name = "foo_test", + srcs = ["foo_test.py"], + visibility = ["//visibility:public"], +)
diff --git a/tests/ignore_root_user_error/README.md b/tests/ignore_root_user_error/README.md new file mode 100644 index 0000000..47da5eb --- /dev/null +++ b/tests/ignore_root_user_error/README.md
@@ -0,0 +1,2 @@ +# ignore_root_user_errors +There are cases when we have to run Python targets with root, e.g., in Docker containers, requiring setting `ignore_root_user_error = True` when registering Python toolchain. This test makes sure that rules_python works in this case. \ No newline at end of file
diff --git a/tests/ignore_root_user_error/WORKSPACE b/tests/ignore_root_user_error/WORKSPACE new file mode 100644 index 0000000..d2f4d6e --- /dev/null +++ b/tests/ignore_root_user_error/WORKSPACE
@@ -0,0 +1,12 @@ +local_repository( + name = "rules_python", + path = "../..", +) + +load("@rules_python//python:repositories.bzl", "python_register_toolchains") + +python_register_toolchains( + name = "python39", + ignore_root_user_error = True, + python_version = "3.9", +)
diff --git a/tests/ignore_root_user_error/foo_test.py b/tests/ignore_root_user_error/foo_test.py new file mode 100644 index 0000000..724cdcb --- /dev/null +++ b/tests/ignore_root_user_error/foo_test.py
@@ -0,0 +1,13 @@ +# Copyright 2019 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.