Merge pull request #533 from haberman/test-wrappers-bazel

Factored out logic for Python test wrappers, so google3 can use different logic
pull/13171/head
Joshua Haberman 3 years ago committed by GitHub
commit 0b171e2617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      bazel/pyproto_test_wrapper.bzl
  2. 261
      python/pb_unit_tests/BUILD

@ -0,0 +1,34 @@
# copybara:strip_for_google3_begin
def pyproto_test_wrapper(name):
src = name + "_wrapper.py"
native.py_test(
name = name,
srcs = [src],
legacy_create_init = False,
main = src,
data = ["@com_google_protobuf//:testdata"],
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
# copybara:replace_for_google3_begin
#
# def pyproto_test_wrapper(name):
# src = name + "_wrapper.py"
# native.py_test(
# name = name,
# srcs = [src],
# main = src,
# deps = [
# "//net/proto2/python/internal:" + name + "_for_deps",
# "//net/proto2/python/public:use_upb_protos",
# ],
# )
#
# copybara:replace_for_google3_end

@ -23,231 +23,40 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:pyproto_test_wrapper.bzl", "pyproto_test_wrapper")
licenses(["notice"])
py_test(
name = "descriptor_database_test",
srcs = ["descriptor_database_test_wrapper.py"],
legacy_create_init = False,
main = "descriptor_database_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "descriptor_pool_test",
srcs = ["descriptor_pool_test_wrapper.py"],
legacy_create_init = False,
main = "descriptor_pool_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "descriptor_test",
srcs = ["descriptor_test_wrapper.py"],
legacy_create_init = False,
main = "descriptor_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "generator_test",
srcs = ["generator_test_wrapper.py"],
legacy_create_init = False,
main = "generator_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "json_format_test",
srcs = ["json_format_test_wrapper.py"],
legacy_create_init = False,
main = "json_format_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "keywords_test",
srcs = ["keywords_test_wrapper.py"],
legacy_create_init = False,
main = "keywords_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "message_factory_test",
srcs = ["message_factory_test_wrapper.py"],
legacy_create_init = False,
main = "message_factory_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "message_test",
srcs = ["message_test_wrapper.py"],
data = [
"@com_google_protobuf//:testdata",
],
legacy_create_init = False,
main = "message_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "proto_builder_test",
srcs = ["proto_builder_test_wrapper.py"],
legacy_create_init = False,
main = "proto_builder_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "reflection_test",
srcs = ["reflection_test_wrapper.py"],
legacy_create_init = False,
main = "reflection_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "service_reflection_test",
srcs = ["service_reflection_test_wrapper.py"],
legacy_create_init = False,
main = "service_reflection_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "symbol_database_test",
srcs = ["symbol_database_test_wrapper.py"],
legacy_create_init = False,
main = "symbol_database_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "text_encoding_test",
srcs = ["text_encoding_test_wrapper.py"],
legacy_create_init = False,
main = "text_encoding_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "text_format_test",
srcs = ["text_format_test_wrapper.py"],
data = [
"@com_google_protobuf//:testdata",
],
legacy_create_init = False,
main = "text_format_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "unknown_fields_test",
srcs = ["unknown_fields_test_wrapper.py"],
legacy_create_init = False,
main = "unknown_fields_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "well_known_types_test",
srcs = ["well_known_types_test_wrapper.py"],
legacy_create_init = False,
main = "well_known_types_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
py_test(
name = "wire_format_test",
srcs = ["wire_format_test_wrapper.py"],
legacy_create_init = False,
main = "wire_format_test_wrapper.py",
deps = [
"//python:message_ext",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_srcs",
],
)
pyproto_test_wrapper(name = "descriptor_database_test")
pyproto_test_wrapper(name = "descriptor_pool_test")
pyproto_test_wrapper(name = "descriptor_test")
pyproto_test_wrapper(name = "generator_test") # copybara:strip_for_google3
pyproto_test_wrapper(name = "json_format_test")
pyproto_test_wrapper(name = "keywords_test")
pyproto_test_wrapper(name = "message_factory_test")
pyproto_test_wrapper(name = "message_test")
pyproto_test_wrapper(name = "proto_builder_test")
pyproto_test_wrapper(name = "reflection_test")
pyproto_test_wrapper(name = "service_reflection_test")
pyproto_test_wrapper(name = "symbol_database_test")
pyproto_test_wrapper(name = "text_encoding_test")
pyproto_test_wrapper(name = "text_format_test")
pyproto_test_wrapper(name = "unknown_fields_test")
pyproto_test_wrapper(name = "well_known_types_test")
pyproto_test_wrapper(name = "wire_format_test")

Loading…
Cancel
Save