diff --git a/bazel/protobuf.patch b/bazel/protobuf.patch index ffe5debd62..04ed074886 100644 --- a/bazel/protobuf.patch +++ b/bazel/protobuf.patch @@ -1,5 +1,14 @@ --- BUILD +++ BUILD +@@ -525,7 +525,7 @@ cc_binary( + filegroup( + name = "testdata", + srcs = glob(["src/google/protobuf/testdata/**/*"]), +- visibility = ["//:__subpackages__"], ++ visibility = ["//visibility:public"], + ) + + RELATIVE_LITE_TEST_PROTOS = [ @@ -931,13 +931,10 @@ py_library( [ "python/google/protobuf/**/*.py", @@ -45,3 +54,20 @@ ) py_library( + +--- python/google/protobuf/internal/test_util.py ++++ python/google/protobuf/internal/test_util.py +@@ -634,6 +634,13 @@ def GoldenFile(filename): + # Found it. Load the golden file from the testdata directory. + return open(full_path, 'rb') + ++ # Search for cross-repo path. ++ full_path = os.path.join('external/com_google_protobuf/src/google/protobuf/testdata', ++ filename) ++ if os.path.exists(full_path): ++ # Found it. Load the golden file from the testdata directory. ++ return open(full_path, 'rb') ++ + raise RuntimeError( + 'Could not find golden files. This test must be run from within the ' + 'protobuf source package so that it can read test data files from the ' diff --git a/python/pb_unit_tests/BUILD b/python/pb_unit_tests/BUILD index 6a8143b701..b0d79b981d 100644 --- a/python/pb_unit_tests/BUILD +++ b/python/pb_unit_tests/BUILD @@ -124,6 +124,9 @@ py_test( "@com_google_protobuf//:python_common_test_protos", "@com_google_protobuf//:python_specific_test_protos", ], + data = [ + "@com_google_protobuf//:testdata", + ], legacy_create_init = False, ) diff --git a/python/pb_unit_tests/message_test_wrapper.py b/python/pb_unit_tests/message_test_wrapper.py index c63571b568..993f8e0e3d 100644 --- a/python/pb_unit_tests/message_test_wrapper.py +++ b/python/pb_unit_tests/message_test_wrapper.py @@ -36,19 +36,11 @@ message_test.MessageTest.testExtendStringWithNothing_proto2.__unittest_expecting message_test.MessageTest.testExtendStringWithNothing_proto3.__unittest_expecting_failure__ = True message_test.MessageTest.testFloatPrinting_proto2.__unittest_expecting_failure__ = True message_test.MessageTest.testFloatPrinting_proto3.__unittest_expecting_failure__ = True -message_test.MessageTest.testGoldenMessage_proto2.__unittest_expecting_failure__ = True -message_test.MessageTest.testGoldenMessage_proto3.__unittest_expecting_failure__ = True -message_test.MessageTest.testGoldenPackedMessage_proto2.__unittest_expecting_failure__ = True -message_test.MessageTest.testGoldenPackedMessage_proto3.__unittest_expecting_failure__ = True message_test.MessageTest.testHighPrecisionDoublePrinting_proto2.__unittest_expecting_failure__ = True message_test.MessageTest.testHighPrecisionDoublePrinting_proto3.__unittest_expecting_failure__ = True message_test.MessageTest.testInsertRepeatedCompositeField_proto2.__unittest_expecting_failure__ = True message_test.MessageTest.testInsertRepeatedCompositeField_proto3.__unittest_expecting_failure__ = True -message_test.MessageTest.testPickleSupport_proto2.__unittest_expecting_failure__ = True -message_test.MessageTest.testPickleSupport_proto3.__unittest_expecting_failure__ = True message_test.Proto2Test.testExtensionsErrors.__unittest_expecting_failure__ = True -message_test.Proto2Test.testGoldenExtensions.__unittest_expecting_failure__ = True -message_test.Proto2Test.testGoldenPackedExtensions.__unittest_expecting_failure__ = True message_test.Proto2Test.testPythonicInit.__unittest_expecting_failure__ = True message_test.Proto2Test.test_documentation.__unittest_expecting_failure__ = True message_test.Proto3Test.testCopyFromBadType.__unittest_expecting_failure__ = True