@@ -38,7 +38,7 @@ foo[extra]==0.0.1 \
3838foo @ git+https://github.com/org/foo.git@deadbeef
3939""" ,
4040 "requirements_linux" : """\
41- foo==0.0.3 --hash=sha256:deadbaaf
41+ foo==0.0.3 --hash=sha256:deadbaaf --hash=sha256:5d15t
4242""" ,
4343 # download_only = True
4444 "requirements_linux_download_only" : """\
@@ -67,7 +67,7 @@ foo==0.0.4 @ https://example.org/foo-0.0.4.whl
6767foo==0.0.5 @ https://example.org/foo-0.0.5.whl --hash=sha256:deadbeef
6868""" ,
6969 "requirements_osx" : """\
70- foo==0.0.3 --hash=sha256:deadbaaf
70+ foo==0.0.3 --hash=sha256:deadbaaf --hash=sha256:deadb11f --hash=sha256:5d15t
7171""" ,
7272 "requirements_osx_download_only" : """\
7373 --platform=macosx_10_9_arm64
@@ -251,7 +251,7 @@ def _test_multi_os(env):
251251 struct (
252252 distribution = "foo" ,
253253 extra_pip_args = [],
254- requirement_line = "foo==0.0.3 --hash=sha256:deadbaaf" ,
254+ requirement_line = "foo==0.0.3 --hash=sha256:deadbaaf --hash=sha256:5d15t " ,
255255 target_platforms = ["linux_x86_64" ],
256256 url = "" ,
257257 filename = "" ,
@@ -515,6 +515,84 @@ def _test_git_sources(env):
515515
516516_tests .append (_test_git_sources )
517517
518+ def _test_overlapping_shas_with_index_results (env ):
519+ got = parse_requirements (
520+ ctx = _mock_ctx (),
521+ requirements_by_platform = {
522+ "requirements_linux" : ["cp39_linux_x86_64" ],
523+ "requirements_osx" : ["cp39_osx_x86_64" ],
524+ },
525+ get_index_urls = lambda _ , __ : {
526+ "foo" : struct (
527+ sdists = {
528+ "5d15t" : struct (
529+ url = "sdist" ,
530+ sha256 = "5d15t" ,
531+ filename = "foo-0.0.1.tar.gz" ,
532+ yanked = False ,
533+ ),
534+ },
535+ whls = {
536+ "deadb11f" : struct (
537+ url = "super2" ,
538+ sha256 = "deadb11f" ,
539+ filename = "foo-0.0.1-py3-none-macosx_14_0_x86_64.whl" ,
540+ yanked = False ,
541+ ),
542+ "deadbaaf" : struct (
543+ url = "super2" ,
544+ sha256 = "deadbaaf" ,
545+ filename = "foo-0.0.1-py3-none-any.whl" ,
546+ yanked = False ,
547+ ),
548+ },
549+ ),
550+ },
551+ )
552+
553+ env .expect .that_collection (got ).contains_exactly ([
554+ struct (
555+ name = "foo" ,
556+ is_exposed = True ,
557+ # TODO @aignas 2025-05-25: how do we rename this?
558+ is_multiple_versions = True ,
559+ srcs = [
560+ struct (
561+ distribution = "foo" ,
562+ extra_pip_args = [],
563+ filename = "foo-0.0.1-py3-none-any.whl" ,
564+ requirement_line = "foo==0.0.3" ,
565+ sha256 = "deadbaaf" ,
566+ target_platforms = ["cp39_linux_x86_64" , "cp39_osx_x86_64" ],
567+ url = "super2" ,
568+ yanked = False ,
569+ ),
570+ struct (
571+ distribution = "foo" ,
572+ extra_pip_args = [],
573+ filename = "foo-0.0.1.tar.gz" ,
574+ requirement_line = "foo==0.0.3" ,
575+ sha256 = "5d15t" ,
576+ target_platforms = ["cp39_linux_x86_64" , "cp39_osx_x86_64" ],
577+ url = "sdist" ,
578+ yanked = False ,
579+ ),
580+ struct (
581+ distribution = "foo" ,
582+ extra_pip_args = [],
583+ filename = "foo-0.0.1-py3-none-macosx_14_0_x86_64.whl" ,
584+ requirement_line = "foo==0.0.3" ,
585+ sha256 = "deadb11f" ,
586+ target_platforms = ["cp39_osx_x86_64" ],
587+ url = "super2" ,
588+ yanked = False ,
589+ ),
590+ ],
591+ ),
592+ ])
593+
594+ _tests .append (_test_overlapping_shas_with_index_results )
595+
518596def parse_requirements_test_suite (name ):
519597 """Create the test suite.
520598
0 commit comments