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") 17load("//bazel:logging_threshold_test.bzl", "py_grpc_logging_threshold_test") 18 19def internal_py_grpc_test(name, **kwargs): 20 """Runs a test under all supported environments. 21 22 Args: 23 name: The name of the test. 24 **kwargs: Any additional arguments to add to the test. 25 """ 26 native.py_test( 27 name = name + ".native", 28 python_version = "PY3", 29 **kwargs 30 ) 31 py_grpc_gevent_test(name, **kwargs) 32 py_grpc_logging_threshold_test(name, **kwargs) 33 34 suite_kwargs = {} 35 if "visibility" in kwargs: 36 suite_kwargs["visibility"] = kwargs["visibility"] 37 38 native.test_suite( 39 name = name, 40 tests = [ 41 name + ".native", 42 name + ".gevent", 43 name + ".logging_threshold", 44 ], 45 **suite_kwargs 46 ) 47