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