@@ -434,7 +434,7 @@ def _test_multiple_musllinux_exact_params(env):
434434
435435_tests .append (_test_multiple_musllinux_exact_params )
436436
437- def _test_multiple_highest_closest_match (env ):
437+ def _test_multiple_mvs_match (env ):
438438 got = _select_whl (
439439 whls = [
440440 "pkg-0.0.1-py3-none-musllinux_1_4_x86_64.whl" ,
@@ -449,12 +449,58 @@ def _test_multiple_highest_closest_match(env):
449449 _match (
450450 env ,
451451 got ,
452- # select the one with the lowest version, because of the input to the function
452+ # select the one with the lowest version
453+ "pkg-0.0.1-py3-none-musllinux_1_2_x86_64.whl" ,
453454 "pkg-0.0.1-py3-none-musllinux_1_1_x86_64.whl" ,
455+ )
456+
457+ _tests .append (_test_multiple_mvs_match )
458+
459+ def _test_multiple_mvs_match_override_more_specific (env ):
460+ got = _select_whl (
461+ whls = [
462+ "pkg-0.0.1-py3-none-musllinux_1_4_x86_64.whl" ,
463+ "pkg-0.0.1-py3-none-musllinux_1_2_x86_64.whl" ,
464+ "pkg-0.0.1-py3-none-musllinux_1_1_x86_64.whl" ,
465+ ],
466+ whl_platform_tags = [
467+ "musllinux_*_x86_64" , # default to something
468+ "musllinux_1_3_x86_64" , # override the previous
469+ ],
470+ whl_abi_tags = ["none" ],
471+ python_version = "3.12" ,
472+ limit = 2 ,
473+ )
474+ _match (
475+ env ,
476+ got ,
477+ # Should be the same as without the `*` match
454478 "pkg-0.0.1-py3-none-musllinux_1_2_x86_64.whl" ,
479+ "pkg-0.0.1-py3-none-musllinux_1_1_x86_64.whl" ,
480+ )
481+
482+ _tests .append (_test_multiple_mvs_match_override_more_specific )
483+
484+ def _test_multiple_mvs_match_override_less_specific (env ):
485+ got = _select_whl (
486+ whls = [
487+ "pkg-0.0.1-py3-none-musllinux_1_4_x86_64.whl" ,
488+ ],
489+ whl_platform_tags = [
490+ "musllinux_1_3_x86_64" , # default to 1.3
491+ "musllinux_*_x86_64" , # then override to something less specific
492+ ],
493+ whl_abi_tags = ["none" ],
494+ python_version = "3.12" ,
495+ limit = 2 ,
496+ )
497+ _match (
498+ env ,
499+ got ,
500+ "pkg-0.0.1-py3-none-musllinux_1_4_x86_64.whl" ,
455501 )
456502
457- _tests .append (_test_multiple_highest_closest_match )
503+ _tests .append (_test_multiple_mvs_match_override_less_specific )
458504
459505def _test_android (env ):
460506 got = _select_whl (
0 commit comments