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