Skip to content
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

Add test size option #180

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions uv/pip.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def pip_compile(
args = None,
data = None,
tags = None,
size = None,
**kwargs):
"""
Produce targets to compile a requirements.in or pyproject.toml file into a requirements.txt file.
Expand All @@ -33,6 +34,7 @@ def pip_compile(
--no-strip-extras (Include extras in the output file)
data: (optional) a list of labels of additional files to include
tags: (optional) tags to apply to the generated test target
size: (optional) size of the test target, see https://bazel.build/reference/test-encyclopedia#role-test-runner
**kwargs: (optional) other fields passed through to all underlying rules

Targets produced by this macro are:
Expand All @@ -43,6 +45,7 @@ def pip_compile(
requirements_in = requirements_in or "//:requirements.in"
requirements_txt = requirements_txt or "//:requirements.txt"
tags = tags or []
size = size or "small"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mark-thm Choosing small as the default since this will most likely match the expected size of the test according to https://bazel.build/reference/be/common-definitions#common-attributes-tests

if types.is_list(requirements_in):
write_target = "_{}.write".format(name)
write_file(
Expand Down Expand Up @@ -82,5 +85,6 @@ def pip_compile(
data = data,
uv_args = args,
tags = ["requires-network"] + tags,
size = size,
**kwargs
)
Loading