xref: /aosp_15_r20/external/grpc-grpc/src/python/grpcio_tests/tests/unit/BUILD.bazel (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
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.
14load("//bazel:internal_python_rules.bzl", "internal_py_grpc_test")
15load("@grpc_python_dependencies//:requirements.bzl", "requirement")
16
17package(default_visibility = ["//visibility:public"])
18
19GRPCIO_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    "_utilities_test.py",
58    "_xds_credentials_test.py",
59]
60
61py_library(
62    name = "_tcp_proxy",
63    srcs = ["_tcp_proxy.py"],
64)
65
66py_library(
67    name = "_signal_client",
68    srcs = ["_signal_client.py"],
69    deps = [
70        requirement("gevent"),
71    ],
72)
73
74py_library(
75    name = "resources",
76    srcs = ["resources.py"],
77    data = [
78        "//src/python/grpcio_tests/tests/unit/credentials",
79    ],
80)
81
82py_library(
83    name = "test_common",
84    srcs = ["test_common.py"],
85)
86
87py_library(
88    name = "thread_pool",
89    srcs = ["thread_pool.py"],
90)
91
92py_library(
93    name = "_exit_scenarios",
94    srcs = ["_exit_scenarios.py"],
95)
96
97py_library(
98    name = "_rpc_test_helpers",
99    srcs = ["_rpc_test_helpers.py"],
100)
101
102py_library(
103    name = "_server_shutdown_scenarios",
104    srcs = ["_server_shutdown_scenarios.py"],
105)
106
107py_library(
108    name = "_from_grpc_import_star",
109    srcs = ["_from_grpc_import_star.py"],
110)
111
112[
113    internal_py_grpc_test(
114        name = test_file_name[:-3],
115        size = "small",
116        srcs = [test_file_name],
117        data = [
118            "//src/python/grpcio_tests/tests/unit/credentials",
119        ],
120        imports = ["../../"],
121        main = test_file_name,
122        deps = [
123            ":_exit_scenarios",
124            ":_from_grpc_import_star",
125            ":_rpc_test_helpers",
126            ":_server_shutdown_scenarios",
127            ":_signal_client",
128            ":_tcp_proxy",
129            ":resources",
130            ":test_common",
131            ":thread_pool",
132            "//src/python/grpcio/grpc:grpcio",
133            "//src/python/grpcio_tests/tests/testing",
134            "//src/python/grpcio_tests/tests/unit/framework/common",
135        ],
136    )
137    for test_file_name in GRPCIO_TESTS_UNIT
138]
139
140internal_py_grpc_test(
141    name = "_dynamic_stubs_test",
142    size = "small",
143    srcs = ["_dynamic_stubs_test.py"],
144    data = [
145        "data/foo/bar.proto",
146        "data/foo/bar_with_wkt.proto",
147    ],
148    imports = ["../../"],
149    main = "_dynamic_stubs_test.py",
150    deps = [
151        ":test_common",
152        "//src/python/grpcio/grpc:grpcio",
153        "//src/python/grpcio_tests/tests/testing",
154        "//tools/distrib/python/grpcio_tools:grpc_tools",
155    ],
156)
157