Skip to content

Commit

Permalink
add test for multiple requirement input files
Browse files Browse the repository at this point in the history
  • Loading branch information
cj81499 committed May 10, 2023
1 parent 29d4fd5 commit c7bff55
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/multiple_requirements_in/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

compile_pip_requirements(
name = "requirements",
extra_args = [
"--allow-unsafe",
"--resolver=backtracking",
],
requirements_in = [
"requirements_1.in",
"requirements_2.in",
],
requirements_txt = "requirements.txt",
)
2 changes: 2 additions & 0 deletions tests/multiple_requirements_in/README.md
Original file line number Diff line number Diff line change
@@ -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.
19 changes: 19 additions & 0 deletions tests/multiple_requirements_in/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
workspace(name = "multiple_requirements_in")

local_repository(
name = "rules_python",
path = "../..",
)

load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")

py_repositories()

load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies")

pip_install_dependencies()

python_register_toolchains(
name = "python39",
python_version = "3.9",
)
14 changes: 14 additions & 0 deletions tests/multiple_requirements_in/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# bazel run //tests/multiple_requirements_in:requirements.update
#
attrs==22.2.0 \
--hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \
--hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99
# via -r tests/multiple_requirements_in/requirements_2.in
urllib3==1.26.14 \
--hash=sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72 \
--hash=sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1
# via -r tests/multiple_requirements_in/requirements_1.in
1 change: 1 addition & 0 deletions tests/multiple_requirements_in/requirements_1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
urllib3 ~= 1.26
1 change: 1 addition & 0 deletions tests/multiple_requirements_in/requirements_2.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
attrs ~= 22.2

0 comments on commit c7bff55

Please sign in to comment.