|
15 | 15 | from packaging.requirements import Requirement |
16 | 16 | from packaging.specifiers import SpecifierSet |
17 | 17 | from packaging.version import Version |
18 | | -from utils import VERSIONS_RE, get_all_testcase_directories, get_gitignore_spec, spec_matches_path, strip_comments |
| 18 | +from utils import ( |
| 19 | + METADATA_MAPPING, |
| 20 | + VERSIONS_RE, |
| 21 | + get_all_testcase_directories, |
| 22 | + get_gitignore_spec, |
| 23 | + spec_matches_path, |
| 24 | + strip_comments, |
| 25 | +) |
19 | 26 |
|
20 | 27 | metadata_keys = { |
21 | 28 | "version", |
@@ -182,11 +189,19 @@ def check_metadata() -> None: |
182 | 189 | for key in data.get("tool", {}).get(tool, {}): |
183 | 190 | assert key in tk, f"Unrecognised {tool} key {key} for {distribution}" |
184 | 191 |
|
185 | | - specified_stubtest_platforms = set(data.get("tool", {}).get("stubtest", {}).get("platforms", [])) |
| 192 | + tool_stubtest = data.get("tool", {}).get("stubtest", {}) |
| 193 | + specified_stubtest_platforms = set(tool_stubtest.get("platforms", [])) |
186 | 194 | assert ( |
187 | 195 | specified_stubtest_platforms <= supported_stubtest_platforms |
188 | 196 | ), f"Unrecognised platforms specified: {supported_stubtest_platforms - specified_stubtest_platforms}" |
189 | 197 |
|
| 198 | + # Check that only specified platforms install packages: |
| 199 | + for supported_plat in supported_stubtest_platforms: |
| 200 | + if supported_plat not in specified_stubtest_platforms: |
| 201 | + assert ( |
| 202 | + METADATA_MAPPING[supported_plat] not in tool_stubtest |
| 203 | + ), f"Installing system deps for unspecified platform {supported_plat} for {distribution}" |
| 204 | + |
190 | 205 |
|
191 | 206 | def get_txt_requirements() -> dict[str, SpecifierSet]: |
192 | 207 | with open("requirements-tests.txt", encoding="UTF-8") as requirements_file: |
|
0 commit comments