Skip to content

Commit cf76913

Browse files
committed
wip
1 parent cfcc8c5 commit cf76913

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

tests/pypi/extension/extension_tests.bzl

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _mock_mctx(*modules, environ = {}, read = None):
2727
name = "unittest",
2828
arch = "exotic",
2929
),
30-
read = read or (lambda _: "simple==0.0.1 --hash=sha256:deadbeef"),
30+
read = read or (lambda _: "simple==0.0.1 --hash=sha256:deadbeef --hash=sha256:deadbaaf"),
3131
modules = [
3232
struct(
3333
name = modules[0].name,
@@ -168,7 +168,7 @@ def _test_simple(env):
168168
"dep_template": "@pypi//{name}:{target}",
169169
"python_interpreter_target": "unit_test_interpreter_target",
170170
"repo": "pypi_315",
171-
"requirement": "simple==0.0.1 --hash=sha256:deadbeef",
171+
"requirement": "simple==0.0.1 --hash=sha256:deadbeef --hash=sha256:deadbaaf",
172172
},
173173
})
174174
pypi.whl_mods().contains_exactly({})
@@ -359,7 +359,14 @@ def _test_simple_get_index(env):
359359
got_simpleapi_download_kwargs.update(kwargs)
360360
return {
361361
"simple": struct(
362-
whls = {},
362+
whls = {
363+
"deadbaaf": struct(
364+
yanked = False,
365+
filename = "simple-0.0.1-py3-none-any.whl",
366+
sha256 = "deadbaaf",
367+
url = "example.org/whl",
368+
),
369+
},
363370
sdists = {
364371
"deadbeef": struct(
365372
yanked = False,
@@ -385,6 +392,11 @@ def _test_simple_get_index(env):
385392
),
386393
],
387394
),
395+
read = lambda _: """\
396+
# Keep sorted
397+
simple==0.0.1 --hash=sha256:deadbeef --hash=sha256:deadbaaf
398+
some_pkg==0.0.1
399+
""",
388400
),
389401
available_interpreters = {
390402
"python_3_15_host": "unit_test_interpreter_target",
@@ -393,10 +405,17 @@ def _test_simple_get_index(env):
393405
)
394406

395407
pypi.is_reproducible().equals(False)
396-
pypi.exposed_packages().contains_exactly({"pypi": ["simple"]})
408+
pypi.exposed_packages().contains_exactly({"pypi": ["simple", "some_pkg"]})
397409
pypi.hub_group_map().contains_exactly({"pypi": {}})
398410
pypi.hub_whl_map().contains_exactly({"pypi": {
399411
"simple": [
412+
struct(
413+
config_setting = "//_config:is_python_3.15",
414+
filename = "simple-0.0.1-py3-none-any.whl",
415+
repo = "pypi_315_simple_py3_none_any_deadbaaf",
416+
target_platforms = None,
417+
version = "3.15",
418+
),
400419
struct(
401420
config_setting = "//_config:is_python_3.15",
402421
filename = "simple-0.0.1.tar.gz",
@@ -405,8 +424,29 @@ def _test_simple_get_index(env):
405424
version = "3.15",
406425
),
407426
],
427+
"some_pkg": [
428+
],
408429
}})
409430
pypi.whl_libraries().contains_exactly({
431+
"pypi_315_simple_py3_none_any_deadbaaf": {
432+
"dep_template": "@pypi//{name}:{target}",
433+
"experimental_target_platforms": [
434+
"cp315_linux_aarch64",
435+
"cp315_linux_arm",
436+
"cp315_linux_ppc",
437+
"cp315_linux_s390x",
438+
"cp315_linux_x86_64",
439+
"cp315_osx_aarch64",
440+
"cp315_osx_x86_64",
441+
"cp315_windows_x86_64",
442+
],
443+
"filename": "simple-0.0.1-py3-none-any.whl",
444+
"python_interpreter_target": "unit_test_interpreter_target",
445+
"repo": "pypi_315",
446+
"requirement": "simple==0.0.1",
447+
"sha256": "deadbaaf",
448+
"urls": ["example.org/whl"],
449+
},
410450
"pypi_315_simple_sdist_deadbeef": {
411451
"dep_template": "@pypi//{name}:{target}",
412452
"experimental_target_platforms": [
@@ -426,8 +466,27 @@ def _test_simple_get_index(env):
426466
"sha256": "deadbeef",
427467
"urls": ["example.org"],
428468
},
469+
"pypi_315_some_pkg": {
470+
"dep_template": "@pypi//{name}:{target}",
471+
"python_interpreter_target": "unit_test_interpreter_target",
472+
"repo": "pypi_315",
473+
"requirement": "some_pkg==0.0.1",
474+
},
429475
})
430476
pypi.whl_mods().contains_exactly({})
477+
env.expect.that_dict(got_simpleapi_download_kwargs).contains_exactly({
478+
"attr": struct(
479+
auth_patterns = {},
480+
envsubst = {},
481+
extra_index_urls = [],
482+
index_url = "pypi.org",
483+
index_url_overrides = {},
484+
netrc = None,
485+
sources = ["simple", "some_pkg"],
486+
),
487+
"cache": {},
488+
"parallel_download": False,
489+
})
431490

432491
_tests.append(_test_simple_get_index)
433492

0 commit comments

Comments
 (0)