1# Copyright 2019 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 15load("@rules_python//python:defs.bzl", "py_library", "py_test") 16 17package( 18 default_testonly = 1, 19 default_visibility = ["//visibility:public"], 20) 21 22GRPC_ASYNC_TESTS = glob(["*_test.py"]) 23 24py_library( 25 name = "_test_base", 26 srcs = ["_test_base.py"], 27 srcs_version = "PY3", 28) 29 30py_library( 31 name = "_constants", 32 srcs = ["_constants.py"], 33 srcs_version = "PY3", 34) 35 36py_library( 37 name = "_test_server", 38 srcs = ["_test_server.py"], 39 srcs_version = "PY3", 40 deps = [ 41 ":_constants", 42 "//src/proto/grpc/testing:empty_py_pb2", 43 "//src/proto/grpc/testing:py_messages_proto", 44 "//src/proto/grpc/testing:test_py_pb2_grpc", 45 "//src/python/grpcio/grpc:grpcio", 46 "//src/python/grpcio_tests/tests/unit:resources", 47 ], 48) 49 50py_library( 51 name = "_common", 52 srcs = ["_common.py"], 53 srcs_version = "PY3", 54) 55 56_FLAKY_TESTS = [ 57 # TODO(https://github.com/grpc/grpc/issues/22347) remove from this list. 58 "channel_argument_test.py", 59] 60 61[ 62 py_test( 63 name = test_file_name[:-3], 64 size = "small", 65 srcs = [test_file_name], 66 data = [ 67 "//src/python/grpcio_tests/tests/unit/credentials", 68 ], 69 flaky = test_file_name in _FLAKY_TESTS, 70 imports = ["../../"], 71 main = test_file_name, 72 python_version = "PY3", 73 deps = [ 74 ":_common", 75 ":_constants", 76 ":_test_base", 77 ":_test_server", 78 "//src/proto/grpc/testing:benchmark_service_py_pb2", 79 "//src/proto/grpc/testing:benchmark_service_py_pb2_grpc", 80 "//src/proto/grpc/testing:py_messages_proto", 81 "//src/python/grpcio/grpc:grpcio", 82 "//src/python/grpcio_tests/tests/unit:resources", 83 "//src/python/grpcio_tests/tests/unit/framework/common", 84 ], 85 ) 86 for test_file_name in GRPC_ASYNC_TESTS 87] 88