Skip to content

Commit 1ac0437

Browse files
committed
finish a test
1 parent 9a79668 commit 1ac0437

File tree

1 file changed

+84
-19
lines changed

1 file changed

+84
-19
lines changed

tests/uv/uv/uv_tests.bzl

Lines changed: 84 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,42 @@ load("//python/uv/private:uv.bzl", "parse_modules") # buildifier: disable=bzl-v
2121
_tests = []
2222

2323
def _mock_mctx(*modules, download = None, read = None):
24+
manifest_files = {
25+
"different.json": {
26+
x: {
27+
"checksum": x + ".sha256",
28+
"kind": "executable-zip",
29+
}
30+
for x in ["linux", "osx"]
31+
} | {
32+
x + ".sha256": {
33+
"name": x + ".sha256",
34+
"target_triples": [x],
35+
}
36+
for x in ["linux", "osx"]
37+
},
38+
"manifest.json": {
39+
x: {
40+
"checksum": x + ".sha256",
41+
"kind": "executable-zip",
42+
}
43+
for x in ["linux", "os", "osx"]
44+
} | {
45+
x + ".sha256": {
46+
"name": x + ".sha256",
47+
"target_triples": [x],
48+
}
49+
for x in ["linux", "os", "osx"]
50+
},
51+
}
52+
2453
fake_fs = {
2554
"linux.sha256": "deadbeef linux",
26-
"manifest.json": json.encode({
27-
"artifacts": {
28-
x: {
29-
"checksum": x + ".sha256",
30-
"kind": "executable-zip",
31-
}
32-
for x in ["linux", "os", "osx"]
33-
} | {
34-
x + ".sha256": {
35-
"name": x + ".sha256",
36-
"target_triples": [x],
37-
}
38-
for x in ["linux", "os", "osx"]
39-
},
40-
}),
4155
"os.sha256": "deadbeef os",
4256
"osx.sha256": "deadb00f osx",
57+
} | {
58+
fname: json.encode({"artifacts": contents})
59+
for fname, contents in manifest_files.items()
4360
}
4461

4562
return struct(
@@ -296,11 +313,59 @@ def _test_complex_configuring(env):
296313
uv_repository = lambda **kwargs: calls.append(kwargs),
297314
)
298315

299-
uv.names().contains_exactly([])
300-
uv.labels().contains_exactly({})
301-
uv.compatible_with().contains_exactly({})
302-
uv.target_settings().contains_exactly({})
316+
uv.names().contains_exactly([
317+
"uv_1_0_0_os_toolchain",
318+
"uv_1_0_1_os_toolchain",
319+
"uv_1_0_2_os_toolchain",
320+
"uv_1_0_3_linux_toolchain",
321+
])
322+
uv.labels().contains_exactly({
323+
"uv_1_0_0_os_toolchain": "@uv_1_0_0_os//:uv_toolchain",
324+
"uv_1_0_1_os_toolchain": "@uv_1_0_1_os//:uv_toolchain",
325+
"uv_1_0_2_os_toolchain": "@uv_1_0_2_os//:uv_toolchain",
326+
"uv_1_0_3_linux_toolchain": "@uv_1_0_3_linux//:uv_toolchain",
327+
})
328+
uv.compatible_with().contains_exactly({
329+
"uv_1_0_0_os_toolchain": ["@platforms//os:os"],
330+
"uv_1_0_1_os_toolchain": ["@platforms//os:os"],
331+
"uv_1_0_2_os_toolchain": ["@platforms//os:different"],
332+
"uv_1_0_3_linux_toolchain": ["@platforms//os:linux"],
333+
})
334+
uv.target_settings().contains_exactly({
335+
"uv_1_0_0_os_toolchain": [],
336+
"uv_1_0_1_os_toolchain": [],
337+
"uv_1_0_2_os_toolchain": [],
338+
"uv_1_0_3_linux_toolchain": [],
339+
})
303340
env.expect.that_collection(calls).contains_exactly([
341+
{
342+
"name": "uv_1_0_0_os",
343+
"platform": "os",
344+
"sha256": "deadbeef",
345+
"urls": ["https://example.org/1.0.0/os"],
346+
"version": "1.0.0",
347+
},
348+
{
349+
"name": "uv_1_0_1_os",
350+
"platform": "os",
351+
"sha256": "deadbeef",
352+
"urls": ["https://example.org/1.0.1/os"],
353+
"version": "1.0.1",
354+
},
355+
{
356+
"name": "uv_1_0_2_os",
357+
"platform": "os",
358+
"sha256": "deadbeef",
359+
"urls": ["something_different/1.0.2/os"],
360+
"version": "1.0.2",
361+
},
362+
{
363+
"name": "uv_1_0_3_linux",
364+
"platform": "linux",
365+
"sha256": "deadbeef",
366+
"urls": ["https://example.org/1.0.3/linux"],
367+
"version": "1.0.3",
368+
},
304369
])
305370

306371
_tests.append(_test_complex_configuring)

0 commit comments

Comments
 (0)