1717
1818load ("@bazel_skylib//rules:diff_test.bzl" , "diff_test" )
1919load ("@bazel_skylib//rules:expand_template.bzl" , "expand_template" )
20- load ("//python:py_binary .bzl" , "py_binary " )
20+ load ("//python:py_test .bzl" , "py_test " )
2121
2222visibility (["//..." ])
2323
@@ -78,6 +78,7 @@ def _lock_impl(ctx):
7878 lock_args .add ("--custom-compile-command" , update_command )
7979 run_args .extend (("--custom-compile-command" , "'{}'" .format (update_command )))
8080
81+ lock_args .add ("--no-progress" )
8182 lock_args .add ("--python" , py_runtime .interpreter )
8283 lock_args .add_all (args )
8384 lock_args .add_all (srcs )
@@ -225,7 +226,7 @@ def lock(*, name, srcs, out, args = [], **kwargs):
225226 srcs: The srcs to use as inputs.
226227 out: The output file.
227228 args: Extra args to pass to `uv`.
228- **kwargs: Extra kwargs passed to the {obj}`py_binary ` rule.
229+ **kwargs: Extra kwargs passed to the {obj}`py_test ` rule.
229230 """
230231 pkg = native .package_name ()
231232 update_target = "{}.update" .format (name )
@@ -249,14 +250,6 @@ def lock(*, name, srcs, out, args = [], **kwargs):
249250 args = args ,
250251 )
251252
252- if maybe_out :
253- diff_test (
254- name = name + "_test" ,
255- file1 = out + ".new" ,
256- file2 = maybe_out ,
257- tags = ["manual" ],
258- )
259-
260253 _lock_run (
261254 name = locker_target ,
262255 lock = name ,
@@ -271,16 +264,21 @@ def lock(*, name, srcs, out, args = [], **kwargs):
271264 template = "//python/uv/private:copy.py" ,
272265 substitutions = {
273266 'dst = ""' : 'dst = "{}/{}"' .format (pkg , out ),
267+ 'src = ""' : 'src = "{}/{}.new"' .format (pkg , out ),
274268 },
275269 )
276270
277- py_binary (
271+ py_test (
278272 name = update_target ,
279273 srcs = [update_target + ".py" ],
280- data = [name ],
281- env = {
282- "REQUIREMENTS_FILE" : "$(rootpath {})" .format (name ),
283- },
284- tags = ["manual" ],
274+ data = [name ] + ([] if not maybe_out else [maybe_out ]),
285275 ** kwargs
286276 )
277+
278+ if maybe_out :
279+ diff_test (
280+ name = name + "_test" ,
281+ file1 = out + ".new" ,
282+ file2 = maybe_out ,
283+ tags = ["manual" ],
284+ )
0 commit comments