• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 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
17load("@rules_testing//lib:test_suite.bzl", "test_suite")
18load("//python/private/pypi:patch_whl.bzl", "patched_whl_name")  # buildifier: disable=bzl-visibility
19
20_tests = []
21
22def _test_simple(env):
23    got = patched_whl_name("foo-1.2.3-py3-none-any.whl")
24    env.expect.that_str(got).equals("foo-1.2.3+patched-py3-none-any.whl")
25
26_tests.append(_test_simple)
27
28def _test_simple_local_version(env):
29    got = patched_whl_name("foo-1.2.3+special-py3-none-any.whl")
30    env.expect.that_str(got).equals("foo-1.2.3+special.patched-py3-none-any.whl")
31
32_tests.append(_test_simple_local_version)
33
34def patch_whl_test_suite(name):
35    """Create the test suite.
36
37    Args:
38        name: the name of the test suite
39    """
40    test_suite(name = name, basic_tests = _tests)
41