Skip to content

Commit

Permalink
internal change for protobuf
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 573075750
  • Loading branch information
anandolee authored and copybara-github committed Oct 13, 2023
1 parent 0ffef4a commit c75f3e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
22 changes: 10 additions & 12 deletions pybind11_protobuf/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library")

load("//net/proto2/python/public:build_defs.bzl", "py_test_multiple_proto_implementations")

# Placeholder: load py_proto_library
# Placeholder: load py_library
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
Expand Down Expand Up @@ -108,7 +110,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "proto_enum_test",
srcs = ["proto_enum_test.py"],
data = [":proto_enum_module.so"],
Expand All @@ -117,7 +119,6 @@ py_test(
deps = [
":test_py_pb2",
"@com_google_absl_py//absl/testing:absltest",
"@com_google_protobuf//:protobuf_python",
],
)

Expand All @@ -132,7 +133,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "dynamic_message_test",
srcs = ["dynamic_message_test.py"],
data = [":dynamic_message_module.so"],
Expand Down Expand Up @@ -161,7 +162,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "extension_test",
srcs = ["extension_test.py"],
data = [
Expand All @@ -178,7 +179,6 @@ py_test(
":test_py_pb2", # fixdeps: keep - Direct dependency needed in open-source version, see https://github.com/grpc/grpc/issues/22811
"@com_google_absl_py//absl/testing:absltest",
"@com_google_absl_py//absl/testing:parameterized",
"@com_google_protobuf//:protobuf_python",
],
)

Expand All @@ -192,7 +192,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "message_test",
srcs = ["message_test.py"],
data = [
Expand Down Expand Up @@ -221,7 +221,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "pass_by_test",
srcs = ["pass_by_test.py"],
data = [":pass_by_module.so"],
Expand Down Expand Up @@ -259,7 +259,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "wrapped_proto_module_test",
srcs = ["wrapped_proto_module_test.py"],
data = [":wrapped_proto_module.so"],
Expand All @@ -270,7 +270,6 @@ py_test(
":test_py_pb2",
"@com_google_absl_py//absl/testing:absltest",
"@com_google_absl_py//absl/testing:parameterized",
"@com_google_protobuf//:protobuf_python",
],
)

Expand All @@ -285,7 +284,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "thread_module_test",
srcs = ["thread_module_test.py"],
data = [":thread_module.so"],
Expand All @@ -295,7 +294,6 @@ py_test(
":test_py_pb2",
"@com_google_absl_py//absl/testing:absltest",
"@com_google_absl_py//absl/testing:parameterized",
"@com_google_protobuf//:protobuf_python",
],
)

Expand All @@ -308,7 +306,7 @@ pybind_extension(
],
)

py_test(
py_test_multiple_proto_implementations(
name = "regression_wrappers_test",
srcs = ["regression_wrappers_test.py"],
data = [":regression_wrappers_module.so"],
Expand Down
8 changes: 6 additions & 2 deletions pybind11_protobuf/tests/message_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,15 @@ def test_text_format_to_string(self):

def test_text_format_parse(self):
message = text_format.Parse(m.TEXT_FORMAT_MESSAGE, m.make_test_message())
self.assertMultiLineEqual(str(message), m.TEXT_FORMAT_MESSAGE)
self.assertMultiLineEqual(
text_format.MessageToString(message), m.TEXT_FORMAT_MESSAGE
)

def test_text_format_merge(self):
message = text_format.Merge(m.TEXT_FORMAT_MESSAGE, m.make_test_message())
self.assertMultiLineEqual(str(message), m.TEXT_FORMAT_MESSAGE)
self.assertMultiLineEqual(
text_format.MessageToString(message), m.TEXT_FORMAT_MESSAGE
)

def test_proto_2_equal(self):
self.assertProtoEqual(m.TEXT_FORMAT_MESSAGE,
Expand Down

0 comments on commit c75f3e6

Please sign in to comment.