From e80230ae6f6c77e9450e766c3741378318ab13d5 Mon Sep 17 00:00:00 2001 From: Naresh Date: Wed, 3 Oct 2018 11:11:27 +0000 Subject: Add Bazel targets for Python unit tests There are exactly 50 tests under grpcio_tests/tests/testing and grpcio_tests/tests/unit for gRPC Python. Add Bazel targets for 44 of them. unit._reconnect_test has been left out for now due to an unexpected RuntimeError (#16336) and unit._server_ssl_cert_config_test because of changes needed to the import path within src/python/grpcio_tests/tests/testing/proto/services.proto (will possibly be included as a fix to #15370). The count of tests here is reported the way unittest counts tests, which is the number of individual unit test classes it sees. This will be different from Bazel's count, which counts the number of Bazel test targets, which (by convention mostly) is one per test module. --- src/python/grpcio_tests/tests/unit/BUILD.bazel | 83 ++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/python/grpcio_tests/tests/unit/BUILD.bazel (limited to 'src/python/grpcio_tests/tests/unit/BUILD.bazel') diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel new file mode 100644 index 0000000000..dcd6d9fbb2 --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -0,0 +1,83 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") + +package(default_visibility = ["//visibility:public"]) + +GRPCIO_TESTS_UNIT = [ + "_api_test.py", + "_auth_context_test.py", + "_auth_test.py", + "_channel_args_test.py", + "_channel_close_test.py", + "_channel_connectivity_test.py", + "_channel_ready_future_test.py", + "_compression_test.py", + "_credentials_test.py", + "_empty_message_test.py", + "_exit_test.py", + "_interceptor_test.py", + "_invalid_metadata_test.py", + "_invocation_defects_test.py", + "_metadata_code_details_test.py", + "_metadata_test.py", + # TODO: Issue 16336 + # "_reconnect_test.py", + "_resource_exhausted_test.py", + "_rpc_test.py", + # TODO(ghostwriternr): To be added later. + # "_server_ssl_cert_config_test.py", + "_server_test.py", + "_session_cache_test.py", +] + +py_library( + name = "resources", + srcs = ["resources.py"], + data=[ + "//src/python/grpcio_tests/tests/unit/credentials", + ], +) + +py_library( + name = "test_common", + srcs = ["test_common.py"], +) + +py_library( + name = "_exit_scenarios", + srcs = ["_exit_scenarios.py"], +) + +py_library( + name = "_thread_pool", + srcs = ["_thread_pool.py"], +) + +py_library( + name = "_from_grpc_import_star", + srcs = ["_from_grpc_import_star.py"], +) + +[ + py_test( + name=test_file_name[:-3], + size="small", + srcs=[test_file_name], + main=test_file_name, + deps=[ + "//src/python/grpcio/grpc:grpcio", + ":resources", + ":test_common", + ":_exit_scenarios", + ":_thread_pool", + ":_from_grpc_import_star", + "//src/python/grpcio_tests/tests/unit/framework/common", + "//src/python/grpcio_tests/tests/testing", + requirement('six'), + ], + imports=["../../",], + data=[ + "//src/python/grpcio_tests/tests/unit/credentials", + ], + ) for test_file_name in GRPCIO_TESTS_UNIT +] + -- cgit v1.2.3