|
14 | 14 | """Tests for construction of Python version matching config settings.""" |
15 | 15 |
|
16 | 16 | load("@rules_testing//lib:test_suite.bzl", "test_suite") |
| 17 | +load("//python/private/pypi:pep508_env.bzl", pep508_env = "env") # buildifier: disable=bzl-visibility |
17 | 18 | load("//python/private/pypi:pep508_evaluate.bzl", "evaluate", "tokenize") # buildifier: disable=bzl-visibility |
18 | 19 |
|
19 | 20 | _tests = [] |
@@ -234,6 +235,35 @@ def _evaluate_partial_only_extra(env): |
234 | 235 |
|
235 | 236 | _tests.append(_evaluate_partial_only_extra) |
236 | 237 |
|
| 238 | +def _evaluate_with_aliases(env): |
| 239 | + # When |
| 240 | + for target_platform, tests in { |
| 241 | + # buildifier: @unsorted-dict-items |
| 242 | + "osx_aarch64": { |
| 243 | + "platform_system == 'Darwin' and platform_machine == 'arm64'": True, |
| 244 | + "platform_system == 'Darwin' and platform_machine == 'aarch64'": True, |
| 245 | + "platform_system == 'Darwin' and platform_machine == 'amd64'": False, |
| 246 | + }, |
| 247 | + "osx_x86_64": { |
| 248 | + "platform_system == 'Darwin' and platform_machine == 'amd64'": True, |
| 249 | + "platform_system == 'Darwin' and platform_machine == 'x86_64'": True, |
| 250 | + }, |
| 251 | + "osx_x86_32": { |
| 252 | + "platform_system == 'Darwin' and platform_machine == 'i386'": True, |
| 253 | + "platform_system == 'Darwin' and platform_machine == 'i686'": True, |
| 254 | + "platform_system == 'Darwin' and platform_machine == 'x86_32'": True, |
| 255 | + "platform_system == 'Darwin' and platform_machine == 'x86_64'": False, |
| 256 | + }, |
| 257 | + }.items(): # buildifier: @unsorted-dict-items |
| 258 | + for input, want in tests.items(): |
| 259 | + got = evaluate( |
| 260 | + input, |
| 261 | + env = pep508_env(target_platform), |
| 262 | + ) |
| 263 | + env.expect.that_bool(got).equals(want) |
| 264 | + |
| 265 | +_tests.append(_evaluate_with_aliases) |
| 266 | + |
237 | 267 | def evaluate_test_suite(name): # buildifier: disable=function-docstring |
238 | 268 | test_suite( |
239 | 269 | name = name, |
|
0 commit comments