4040 "read_stubtest_settings" ,
4141]
4242
43+ DEFAULT_STUBTEST_PLATFORMS = ["linux" ]
4344
4445_STUBTEST_PLATFORM_MAPPING : Final = {"linux" : "apt_dependencies" , "darwin" : "brew_dependencies" , "win32" : "choco_dependencies" }
4546# Some older websites have a bad pattern of using query params for navigation.
@@ -81,7 +82,8 @@ class StubtestSettings:
8182 choco_dependencies : list [str ]
8283 extras : list [str ]
8384 ignore_missing_stub : bool
84- platforms : list [str ]
85+ supported_platforms : list [str ] | None # None means all platforms
86+ ci_platforms : list [str ]
8587 stubtest_requirements : list [str ]
8688 mypy_plugins : list [str ]
8789 mypy_plugins_config : dict [str , dict [str , Any ]]
@@ -105,7 +107,8 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
105107 choco_dependencies : object = data .get ("choco_dependencies" , [])
106108 extras : object = data .get ("extras" , [])
107109 ignore_missing_stub : object = data .get ("ignore_missing_stub" , False )
108- specified_platforms : object = data .get ("platforms" , ["linux" ])
110+ supported_platforms : object = data .get ("supported_platforms" )
111+ ci_platforms : object = data .get ("ci_platforms" , DEFAULT_STUBTEST_PLATFORMS )
109112 stubtest_requirements : object = data .get ("stubtest_requirements" , [])
110113 mypy_plugins : object = data .get ("mypy_plugins" , [])
111114 mypy_plugins_config : object = data .get ("mypy_plugins_config" , {})
@@ -114,7 +117,8 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
114117 assert type (ignore_missing_stub ) is bool
115118
116119 # It doesn't work for type-narrowing if we use a for loop here...
117- assert _is_list_of_strings (specified_platforms )
120+ assert supported_platforms is None or _is_list_of_strings (supported_platforms )
121+ assert _is_list_of_strings (ci_platforms )
118122 assert _is_list_of_strings (apt_dependencies )
119123 assert _is_list_of_strings (brew_dependencies )
120124 assert _is_list_of_strings (choco_dependencies )
@@ -123,11 +127,16 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
123127 assert _is_list_of_strings (mypy_plugins )
124128 assert _is_nested_dict (mypy_plugins_config )
125129
126- unrecognised_platforms = set (specified_platforms ) - _STUBTEST_PLATFORM_MAPPING .keys ()
127- assert not unrecognised_platforms , f"Unrecognised platforms specified for { distribution !r} : { unrecognised_platforms } "
130+ unrecognised_platforms = set (ci_platforms ) - _STUBTEST_PLATFORM_MAPPING .keys ()
131+ assert not unrecognised_platforms , f"Unrecognised ci_platforms specified for { distribution !r} : { unrecognised_platforms } "
132+
133+ if supported_platforms is not None :
134+ assert set (ci_platforms ).issubset (
135+ supported_platforms
136+ ), f"ci_platforms must be a subset of supported_platforms for { distribution !r} "
128137
129138 for platform , dep_key in _STUBTEST_PLATFORM_MAPPING .items ():
130- if platform not in specified_platforms :
139+ if platform not in ci_platforms :
131140 assert dep_key not in data , (
132141 f"Stubtest is not run on { platform } in CI for { distribution !r} , "
133142 f"but { dep_key !r} are specified in METADATA.toml"
@@ -140,7 +149,8 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
140149 choco_dependencies = choco_dependencies ,
141150 extras = extras ,
142151 ignore_missing_stub = ignore_missing_stub ,
143- platforms = specified_platforms ,
152+ supported_platforms = supported_platforms ,
153+ ci_platforms = ci_platforms ,
144154 stubtest_requirements = stubtest_requirements ,
145155 mypy_plugins = mypy_plugins ,
146156 mypy_plugins_config = mypy_plugins_config ,
@@ -204,7 +214,8 @@ def is_obsolete(self) -> bool:
204214 "choco_dependencies" ,
205215 "extras" ,
206216 "ignore_missing_stub" ,
207- "platforms" ,
217+ "supported_platforms" ,
218+ "ci_platforms" ,
208219 "stubtest_requirements" ,
209220 "mypy_plugins" ,
210221 "mypy_plugins_config" ,
0 commit comments