BUILD.bazel 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. load("@grpc_python_dependencies//:requirements.bzl", "requirement")
  15. py_library(
  16. name = "client",
  17. testonly = 1,
  18. srcs = ["client.py"],
  19. deps = [
  20. "//examples/protos:helloworld_py_pb2",
  21. "//examples/protos:helloworld_py_pb2_grpc",
  22. "//src/python/grpcio/grpc:grpcio",
  23. "//src/python/grpcio_status/grpc_status",
  24. requirement("googleapis-common-protos"),
  25. ],
  26. )
  27. py_library(
  28. name = "server",
  29. testonly = 1,
  30. srcs = ["server.py"],
  31. deps = [
  32. "//src/python/grpcio/grpc:grpcio",
  33. "//src/python/grpcio_status/grpc_status:grpc_status",
  34. "//examples/protos:helloworld_py_pb2",
  35. "//examples/protos:helloworld_py_pb2_grpc",
  36. ] + select({
  37. "//conditions:default": [requirement("futures")],
  38. "//:python3": [],
  39. }),
  40. )
  41. py_test(
  42. name = "test/_error_handling_example_test",
  43. size = "small",
  44. srcs = ["test/_error_handling_example_test.py"],
  45. imports = [
  46. "../../../src/python/grpcio_status",
  47. "../../../src/python/grpcio_tests",
  48. ],
  49. python_version = "PY3",
  50. deps = [
  51. ":client",
  52. ":server",
  53. "//src/python/grpcio_tests/tests:bazel_namespace_package_hack",
  54. ],
  55. )