| 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 |
load("//bazel:internal_python_rules.bzl", "internal_py_grpc_test") |
| 15 |
load("@grpc_python_dependencies//:requirements.bzl", "requirement") |
| 16 |
|
| 17 |
package(default_visibility = ["//visibility:public"]) |
| 18 |
|
| 19 |
GRPCIO_TESTS_UNIT = [ |
| 20 |
"_abort_test.py", |
| 21 |
"_api_test.py", |
| 22 |
"_auth_context_test.py", |
| 23 |
"_auth_test.py", |
| 24 |
"_version_test.py", |
| 25 |
"_channel_args_test.py", |
| 26 |
"_channel_close_test.py", |
| 27 |
"_channel_connectivity_test.py", |
| 28 |
"_channel_ready_future_test.py", |
| 29 |
"_compression_test.py", |
| 30 |
"_contextvars_propagation_test.py", |
| 31 |
"_credentials_test.py", |
| 32 |
"_dns_resolver_test.py", |
| 33 |
"_empty_message_test.py", |
| 34 |
"_error_message_encoding_test.py", |
| 35 |
# TODO(https://github.com/grpc/grpc/issues/20385) enable this test |
| 36 |
# "_exit_test.py", |
| 37 |
"_grpc_shutdown_test.py", |
| 38 |
"_interceptor_test.py", |
| 39 |
"_invalid_metadata_test.py", |
| 40 |
"_invocation_defects_test.py", |
| 41 |
"_local_credentials_test.py", |
| 42 |
"_logging_test.py", |
| 43 |
"_metadata_flags_test.py", |
| 44 |
"_metadata_code_details_test.py", |
| 45 |
"_metadata_test.py", |
| 46 |
"_reconnect_test.py", |
| 47 |
"_resource_exhausted_test.py", |
| 48 |
"_rpc_part_1_test.py", |
| 49 |
"_rpc_part_2_test.py", |
| 50 |
"_signal_handling_test.py", |
| 51 |
# TODO(ghostwriternr): To be added later. |
| 52 |
# "_server_ssl_cert_config_test.py", |
| 53 |
"_server_test.py", |
| 54 |
"_server_shutdown_test.py", |
| 55 |
"_server_wait_for_termination_test.py", |
| 56 |
"_session_cache_test.py", |
| 57 |
"_xds_credentials_test.py", |
| 58 |
] |
| 59 |
|
| 60 |
py_library( |
| 61 |
name = "_tcp_proxy", |
| 62 |
srcs = ["_tcp_proxy.py"], |
| 63 |
) |
| 64 |
|
| 65 |
py_library( |
| 66 |
name = "_signal_client", |
| 67 |
srcs = ["_signal_client.py"], |
| 68 |
deps = [ |
| 69 |
requirement("gevent"), |
| 70 |
], |
| 71 |
) |
| 72 |
|
| 73 |
py_library( |
| 74 |
name = "resources", |
| 75 |
srcs = ["resources.py"], |
| 76 |
data = [ |
| 77 |
"//src/python/grpcio_tests/tests/unit/credentials", |
| 78 |
], |
| 79 |
) |
| 80 |
|
| 81 |
py_library( |
| 82 |
name = "test_common", |
| 83 |
srcs = ["test_common.py"], |
| 84 |
) |
| 85 |
|
| 86 |
py_library( |
| 87 |
name = "thread_pool", |
| 88 |
srcs = ["thread_pool.py"], |
| 89 |
) |
| 90 |
|
| 91 |
py_library( |
| 92 |
name = "_exit_scenarios", |
| 93 |
srcs = ["_exit_scenarios.py"], |
| 94 |
) |
| 95 |
|
| 96 |
py_library( |
| 97 |
name = "_rpc_test_helpers", |
| 98 |
srcs = ["_rpc_test_helpers.py"], |
| 99 |
) |
| 100 |
|
| 101 |
py_library( |
| 102 |
name = "_server_shutdown_scenarios", |
| 103 |
srcs = ["_server_shutdown_scenarios.py"], |
| 104 |
) |
| 105 |
|
| 106 |
py_library( |
| 107 |
name = "_from_grpc_import_star", |
| 108 |
srcs = ["_from_grpc_import_star.py"], |
| 109 |
) |
| 110 |
|
| 111 |
[ |
| 112 |
internal_py_grpc_test( |
| 113 |
name = test_file_name[:-3], |
| 114 |
size = "small", |
| 115 |
srcs = [test_file_name], |
| 116 |
data = [ |
| 117 |
"//src/python/grpcio_tests/tests/unit/credentials", |
| 118 |
], |
| 119 |
imports = ["../../"], |
| 120 |
main = test_file_name, |
| 121 |
deps = [ |
| 122 |
":_exit_scenarios", |
| 123 |
":_from_grpc_import_star", |
| 124 |
":_rpc_test_helpers", |
| 125 |
":_server_shutdown_scenarios", |
| 126 |
":_signal_client", |
| 127 |
":_tcp_proxy", |
| 128 |
":resources", |
| 129 |
":test_common", |
| 130 |
":thread_pool", |
| 131 |
"//src/python/grpcio/grpc:grpcio", |
| 132 |
"//src/python/grpcio_tests/tests/testing", |
| 133 |
"//src/python/grpcio_tests/tests/unit/framework/common", |
| 134 |
], |
| 135 |
) |
| 136 |
for test_file_name in GRPCIO_TESTS_UNIT |
| 137 |
] |
| 138 |
|
| 139 |
internal_py_grpc_test( |
| 140 |
name = "_dynamic_stubs_test", |
| 141 |
size = "small", |
| 142 |
srcs = ["_dynamic_stubs_test.py"], |
| 143 |
data = [ |
| 144 |
"data/foo/bar.proto", |
| 145 |
"data/foo/bar_with_wkt.proto", |
| 146 |
], |
| 147 |
imports = ["../../"], |
| 148 |
main = "_dynamic_stubs_test.py", |
| 149 |
deps = [ |
| 150 |
":test_common", |
| 151 |
"//src/python/grpcio/grpc:grpcio", |
| 152 |
"//src/python/grpcio_tests/tests/testing", |
| 153 |
"//tools/distrib/python/grpcio_tools:grpc_tools", |
| 154 |
], |
| 155 |
) |