@@ -44,28 +44,33 @@ def define_toolchain_tests(name):
4444 tests = exact_version_tests .values (),
4545 )
4646
47- # Then we expect to get the version in the MINOR_MAPPING if we provide
48- # the version from the MINOR_MAPPING
49- minor_mapping_tests = {
50- (minor , full ): "python_{}_test" .format (minor )
51- for minor , full in MINOR_MAPPING .items ()
52- }
53- native .test_suite (
54- name = "minor_mapping_tests" ,
55- tests = minor_mapping_tests .values (),
56- )
47+ if BZLMOD_ENABLED :
48+ # Then we expect to get the version in the MINOR_MAPPING if we provide
49+ # the version from the MINOR_MAPPING
50+ minor_mapping_tests = {
51+ (minor , full ): "python_{}_test" .format (minor )
52+ for minor , full in MINOR_MAPPING .items ()
53+ }
54+ native .test_suite (
55+ name = "minor_mapping_tests" ,
56+ tests = minor_mapping_tests .values (),
57+ )
5758
58- # Lastly, if we don't provide any version to the transition, we should
59- # get the default version
60- default_version = full_version (
61- # note, this hard codes the version that is in //:WORKSPACE
62- version = DEFAULT_PYTHON_VERSION if BZLMOD_ENABLED else "3.11" ,
63- minor_mapping = MINOR_MAPPING ,
64- )
65- default_version_tests = {
66- (None , default_version ): "default_version_test" ,
67- }
68- tests = exact_version_tests | minor_mapping_tests | default_version_tests
59+ # Lastly, if we don't provide any version to the transition, we should
60+ # get the default version
61+ default_version = full_version (
62+ version = DEFAULT_PYTHON_VERSION ,
63+ minor_mapping = MINOR_MAPPING ,
64+ )
65+ default_version_tests = {
66+ (None , default_version ): "default_version_test" ,
67+ }
68+ tests = exact_version_tests | minor_mapping_tests | default_version_tests
69+ else :
70+ # Outside bzlmod the default version and the minor mapping tests do not
71+ # make sense because the user loading things in the WORKSPACE ultimately defines
72+ # the matching order.
73+ tests = exact_version_tests
6974
7075 for (input_python_version , expect_python_version ), test_name in tests .items ():
7176 meta = TOOL_VERSIONS [expect_python_version ]
0 commit comments