@@ -707,6 +707,77 @@ def _test_register_all_versions(env):
707707
708708_tests .append (_test_register_all_versions )
709709
710+ def _test_ignore_unsupported_versions (env ):
711+ py = parse_modules (
712+ module_ctx = _mock_mctx (
713+ _mod (
714+ name = "my_module" ,
715+ is_root = True ,
716+ toolchain = [
717+ _toolchain ("3.11" ),
718+ _toolchain ("3.12" ),
719+ _toolchain ("3.13" , is_default = True ),
720+ ],
721+ single_version_override = [
722+ _single_version_override (
723+ python_version = "3.13.0" ,
724+ sha256 = {
725+ "aarch64-unknown-linux-gnu" : "deadbeef" ,
726+ },
727+ urls = ["example.org" ],
728+ ),
729+ ],
730+ single_version_platform_override = [
731+ _single_version_platform_override (
732+ sha256 = "deadb00f" ,
733+ urls = ["something.org" ],
734+ platform = "aarch64-unknown-linux-gnu" ,
735+ python_version = "3.13.99" ,
736+ ),
737+ ],
738+ override = [
739+ _override (
740+ base_url = "" ,
741+ available_python_versions = ["3.12.4" , "3.13.0" , "3.13.1" ],
742+ minor_mapping = {
743+ "3.12" : "3.12.4" ,
744+ "3.13" : "3.13.1" ,
745+ },
746+ ),
747+ ],
748+ ),
749+ ),
750+ logger = repo_utils .logger (verbosity_level = 0 , name = "python" ),
751+ )
752+
753+ env .expect .that_str (py .default_python_version ).equals ("3.13" )
754+ env .expect .that_collection (py .config .default ["tool_versions" ].keys ()).contains_exactly ([
755+ "3.12.4" ,
756+ "3.13.0" ,
757+ "3.13.1" ,
758+ ])
759+ env .expect .that_dict (py .config .minor_mapping ).contains_exactly ({
760+ # The mapping is calculated automatically
761+ "3.12" : "3.12.4" ,
762+ "3.13" : "3.13.1" ,
763+ })
764+ env .expect .that_collection (py .toolchains ).contains_exactly ([
765+ struct (
766+ name = name ,
767+ python_version = version ,
768+ register_coverage_tool = False ,
769+ )
770+ for name , version in {
771+ # NOTE: that '3.11' wont be actually registered and present in the
772+ # `tool_versions` above.
773+ "python_3_11" : "3.11" ,
774+ "python_3_12" : "3.12" ,
775+ "python_3_13" : "3.13" ,
776+ }.items ()
777+ ])
778+
779+ _tests .append (_test_ignore_unsupported_versions )
780+
710781def _test_add_patches (env ):
711782 py = parse_modules (
712783 module_ctx = _mock_mctx (
0 commit comments