Skip to content

Commit 363a13f

Browse files
committed
add test for multiple requirement input files
1 parent 6b7ec7f commit 363a13f

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
2+
3+
compile_pip_requirements(
4+
name = "requirements",
5+
extra_args = [
6+
"--allow-unsafe",
7+
"--resolver=backtracking",
8+
],
9+
requirements_in = [
10+
"requirements_1.in",
11+
"requirements_2.in",
12+
],
13+
requirements_txt = "requirements.txt",
14+
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ignore_root_user_errors
2+
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.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
workspace(name = "multiple_requirements_in")
2+
3+
local_repository(
4+
name = "rules_python",
5+
path = "../..",
6+
)
7+
8+
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
9+
10+
py_repositories()
11+
12+
load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies")
13+
14+
pip_install_dependencies()
15+
16+
python_register_toolchains(
17+
name = "python39",
18+
python_version = "3.9",
19+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# bazel run //tests/multiple_requirements_in:requirements.update
6+
#
7+
attrs==22.2.0 \
8+
--hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \
9+
--hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99
10+
# via -r tests/multiple_requirements_in/requirements_2.in
11+
urllib3==1.26.14 \
12+
--hash=sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72 \
13+
--hash=sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1
14+
# via -r tests/multiple_requirements_in/requirements_1.in
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
urllib3 ~= 1.26
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
attrs ~= 22.2

0 commit comments

Comments
 (0)