|
| 1 | +# Copyright 2023 The Bazel Authors. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +"" |
| 16 | + |
| 17 | +load("@rules_testing//lib:test_suite.bzl", "test_suite") |
| 18 | +load("//python/private:whl_target_platforms.bzl", "whl_target_platforms") # buildifier: disable=bzl-visibility |
| 19 | + |
| 20 | +_tests = [] |
| 21 | + |
| 22 | +def _test_simple(env): |
| 23 | + tests = { |
| 24 | + "macosx_10_9_arm64": [ |
| 25 | + struct(os = "osx", cpu = "aarch64"), |
| 26 | + ], |
| 27 | + "macosx_10_9_universal2": [ |
| 28 | + struct(os = "osx", cpu = "x86_64"), |
| 29 | + struct(os = "osx", cpu = "aarch64"), |
| 30 | + ], |
| 31 | + "manylinux1_i686.manylinux_2_17_i686": [ |
| 32 | + struct(os = "linux", cpu = "x86_32"), |
| 33 | + ], |
| 34 | + "musllinux_1_1_ppc64le": [ |
| 35 | + struct(os = "linux", cpu = "ppc"), |
| 36 | + ], |
| 37 | + "win_amd64": [ |
| 38 | + struct(os = "windows", cpu = "x86_64"), |
| 39 | + ], |
| 40 | + } |
| 41 | + |
| 42 | + for give, want in tests.items(): |
| 43 | + got = whl_target_platforms(give) |
| 44 | + env.expect.that_collection(got).contains_exactly(want) |
| 45 | + |
| 46 | +_tests.append(_test_simple) |
| 47 | + |
| 48 | +def whl_target_platforms_test_suite(name): |
| 49 | + """Create the test suite. |
| 50 | +
|
| 51 | + Args: |
| 52 | + name: the name of the test suite |
| 53 | + """ |
| 54 | + test_suite(name = name, basic_tests = _tests) |
0 commit comments