1# Copyright 2021 The gRPC Authors 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"""Python-related rules intended only for use internal to the repo.""" 15 16load("//bazel:gevent_test.bzl", "py_grpc_gevent_test") 17 18def internal_py_grpc_test(name, **kwargs): 19 """Runs a test under all supported environments. 20 21 Args: 22 name: The name of the test. 23 **kwargs: Any additional arguments to add to the test. 24 """ 25 native.py_test( 26 name = name + ".native", 27 python_version = "PY3", 28 **kwargs 29 ) 30 py_grpc_gevent_test(name, **kwargs) 31 32 suite_kwargs = {} 33 if "visibility" in kwargs: 34 suite_kwargs["visibility"] = kwargs["visibility"] 35 36 native.test_suite( 37 name = name, 38 tests = [ 39 name + ".native", 40 name + ".gevent", 41 ], 42 **suite_kwargs 43 ) 44