Skip to content

Commit

Permalink
pw_rpc: Add unit tests to the bazel build
Browse files Browse the repository at this point in the history
Change-Id: I27ad4c45ad69f528243b4680866ccfdc613f8bb4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/94301
Reviewed-by: Anthony DiGirolamo <[email protected]>
Commit-Queue: Ted Pudlik <[email protected]>
  • Loading branch information
tpudlik authored and CQ Bot Account committed May 12, 2022
1 parent be3bb88 commit 1d8f780
Showing 1 changed file with 65 additions and 33 deletions.
98 changes: 65 additions & 33 deletions pw_rpc/py/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -92,45 +92,77 @@ py_library(
"pw_rpc/client.py",
":pw_rpc_common_sources",
],
# TODO(tonymd): Figure out the right way to handle generated protos
# data = [
# # Copy packet_pb2.py
# # From: //pw_rpc/internal/packet_pb2.py
# # To: //pw_rpc/py/pw_rpc/internal/packet_pb2.py
# ":copy_packet_pb2",
# ],
imports = ["."],
deps = [
"//pw_protobuf/py:pw_protobuf",
"//pw_protobuf_compiler/py:pw_protobuf_compiler",
"//pw_rpc:internal_packet_proto_pb2",
"//pw_status/py:pw_status",
],
)

# TODO(tonymd): Figure out the right way to handle generated protos
# load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
# copy_file(
# name = "copy_packet_pb2",
# src = "//pw_rpc:internal_packet_proto_pb2",
# out = "pw_rpc/internal/packet_pb2.py",
# allow_symlink = True,
# )
py_test(
name = "callback_client_test",
size = "small",
srcs = [
"tests/callback_client_test.py",
],
deps = [
":pw_rpc",
"//pw_protobuf_compiler:pw_protobuf_compiler_protos",
"//pw_rpc:internal_packet_proto_pb2",
"//pw_status/py:pw_status",
],
)

py_test(
name = "client_test",
size = "small",
srcs = [
"tests/client_test.py",
],
deps = [
":pw_rpc",
"//pw_rpc:internal_packet_proto_pb2",
"//pw_status/py:pw_status",
],
)

py_test(
name = "descriptors_test",
size = "small",
srcs = [
"tests/descriptors_test.py",
],
deps = [
":pw_rpc",
"//pw_protobuf_compiler:pw_protobuf_compiler_protos",
"@com_google_protobuf//:protobuf_python",
],
)

py_test(
name = "ids_test",
size = "small",
srcs = [
"tests/ids_test.py",
],
deps = [
":pw_rpc",
"//pw_build/py:pw_build",
"//pw_protobuf_compiler:pw_protobuf_compiler_protos",
],
)

# TODO(tonymd): Figure out the right way to handle generated protos
# py_test(
# name = "client_test",
# size = "small",
# srcs = [
# "tests/client_test.py",
# ],
# data = [
# # Copy packet_pb2.py
# # From: //pw_rpc/internal/packet_pb2.py
# # To: //pw_rpc/py/pw_rpc/internal/packet_pb2.py
# ":copy_packet_pb2",
# ],
# deps = [
# ":pw_rpc",
# "//pw_rpc:internal_packet_proto_pb2",
# ],
# )
py_test(
name = "packets_test",
size = "small",
srcs = [
"tests/packets_test.py",
],
deps = [
":pw_rpc",
"//pw_rpc:internal_packet_proto_pb2",
"//pw_status/py:pw_status",
],
)

0 comments on commit 1d8f780

Please sign in to comment.