Merge pull request #16812 from ghostwriternr/bazel-python-health-check-test

Bazel rules for Python grpcio_health_checking.
pull/16826/head
Nathaniel Manista 7 years ago committed by GitHub
commit 478fedb273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      WORKSPACE
  2. 8
      src/proto/grpc/health/v1/BUILD
  3. 33
      src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel
  4. 15
      src/python/grpcio_tests/tests/health_check/BUILD.bazel

@ -34,10 +34,11 @@ pip_import(
load("@grpc_python_dependencies//:requirements.bzl", "pip_install")
pip_install()
# NOTE(https://github.com/pubref/rules_protobuf/pull/196): Switch to upstream repo after this gets merged.
git_repository(
name="org_pubref_rules_protobuf",
remote="https://github.com/pubref/rules_protobuf",
tag="v0.8.2",
remote="https://github.com/ghostwriternr/rules_protobuf",
tag="v0.8.2.1-alpha",
)
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories")

@ -22,3 +22,11 @@ grpc_proto_library(
name = "health_proto",
srcs = ["health.proto"],
)
filegroup(
name = "health_proto_file",
srcs = [
"health.proto",
],
)

@ -0,0 +1,33 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_library")
package(default_visibility = ["//visibility:public"])
genrule(
name = "mv_health_proto",
srcs = [
"//src/proto/grpc/health/v1:health_proto_file",
],
outs = ["health.proto",],
cmd = "cp $< $@",
)
py_proto_library(
name = "py_health_proto",
protos = [":mv_health_proto",],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)
py_library(
name = "grpc_health",
srcs = ["health.py",],
deps = [
":py_health_proto",
"//src/python/grpcio/grpc:grpcio",
],
imports=["../../",],
)

@ -0,0 +1,15 @@
package(default_visibility = ["//visibility:public"])
py_test(
name = "health_servicer_test",
srcs = ["_health_servicer_test.py"],
main = "_health_servicer_test.py",
size = "small",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_health_checking/grpc_health/v1:grpc_health",
"//src/python/grpcio_tests/tests/unit:test_common",
],
imports = ["../../",],
)
Loading…
Cancel
Save