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/descriptor.c b/python/descriptor.c index b7e8854a85..7364a52452 100644 --- a/python/descriptor.c +++ b/python/descriptor.c @@ -132,11 +132,8 @@ static PyObject* PyUpb_DescriptorBase_GetOptions(PyUpb_DescriptorBase* self, (void)ok; assert(ok); - // Disabled until python/message.c is reviewed and checked in. - // self->options = PyUpb_CMessage_Get(opts2, m, py_arena); + self->options = PyUpb_CMessage_Get(opts2, m, py_arena); Py_DECREF(py_arena); - PyErr_Format(PyExc_NotImplementedError, "Not yet implemented"); - return NULL; } Py_INCREF(self->options); 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/descriptor_pool_test_wrapper.py b/python/pb_unit_tests/descriptor_pool_test_wrapper.py index 1314f1b5fa..3e4faad690 100644 --- a/python/pb_unit_tests/descriptor_pool_test_wrapper.py +++ b/python/pb_unit_tests/descriptor_pool_test_wrapper.py @@ -32,7 +32,6 @@ print(unittest) descriptor_pool_test.AddDescriptorTest.testAddTypeError.__unittest_expecting_failure__ = True descriptor_pool_test.AddDescriptorTest.testEnum.__unittest_expecting_failure__ = True descriptor_pool_test.AddDescriptorTest.testFile.__unittest_expecting_failure__ = True -descriptor_pool_test.AddDescriptorTest.testFileDescriptorOptionsWithCustomDescriptorPool.__unittest_expecting_failure__ = True descriptor_pool_test.AddDescriptorTest.testMessage.__unittest_expecting_failure__ = True descriptor_pool_test.AddDescriptorTest.testService.__unittest_expecting_failure__ = True descriptor_pool_test.CreateDescriptorPoolTest.testFindFieldByName.__unittest_expecting_failure__ = True diff --git a/python/pb_unit_tests/descriptor_test_wrapper.py b/python/pb_unit_tests/descriptor_test_wrapper.py index e4c23b52e2..04a8d4f451 100644 --- a/python/pb_unit_tests/descriptor_test_wrapper.py +++ b/python/pb_unit_tests/descriptor_test_wrapper.py @@ -30,7 +30,6 @@ descriptor_test.DescriptorCopyToProtoTest.testCopyToProto_TypeError.__unittest_e descriptor_test.GeneratedDescriptorTest.testDescriptor.__unittest_expecting_failure__ = True descriptor_test.MakeDescriptorTest.testCamelcaseName.__unittest_expecting_failure__ = True descriptor_test.MakeDescriptorTest.testJsonName.__unittest_expecting_failure__ = True -descriptor_test.MakeDescriptorTest.testMakeDescriptorWithOptions.__unittest_expecting_failure__ = True descriptor_test.NewDescriptorTest.testAggregateOptions.__unittest_expecting_failure__ = True descriptor_test.NewDescriptorTest.testComplexExtensionOptions.__unittest_expecting_failure__ = True descriptor_test.NewDescriptorTest.testContainingServiceFixups.__unittest_expecting_failure__ = True diff --git a/python/pb_unit_tests/generator_test_wrapper.py b/python/pb_unit_tests/generator_test_wrapper.py index 92435cba49..9fd76cc114 100644 --- a/python/pb_unit_tests/generator_test_wrapper.py +++ b/python/pb_unit_tests/generator_test_wrapper.py @@ -27,9 +27,7 @@ from google.protobuf.internal import generator_test import unittest generator_test.GeneratorTest.testExtensionScope.__unittest_expecting_failure__ = True -generator_test.GeneratorTest.testMessageWithCustomOptions.__unittest_expecting_failure__ = True generator_test.GeneratorTest.testOneof.__unittest_expecting_failure__ = True -generator_test.GeneratorTest.testOptions.__unittest_expecting_failure__ = True if __name__ == '__main__': unittest.main(module=generator_test, verbosity=2) diff --git a/python/pb_unit_tests/json_format_test_wrapper.py b/python/pb_unit_tests/json_format_test_wrapper.py index d4c8366970..5e9e69db79 100644 --- a/python/pb_unit_tests/json_format_test_wrapper.py +++ b/python/pb_unit_tests/json_format_test_wrapper.py @@ -26,12 +26,5 @@ from google.protobuf.internal import json_format_test import unittest -json_format_test.JsonFormatTest.testExtensionSerializationDictMatchesProto3Spec.__unittest_expecting_failure__ = True -json_format_test.JsonFormatTest.testExtensionSerializationJsonMatchesProto3Spec.__unittest_expecting_failure__ = True -json_format_test.JsonFormatTest.testExtensionToDictAndBack.__unittest_expecting_failure__ = True -json_format_test.JsonFormatTest.testExtensionToJsonAndBack.__unittest_expecting_failure__ = True -json_format_test.JsonFormatTest.testInvalidMap.__unittest_expecting_failure__ = True -json_format_test.JsonFormatTest.testMapFields.__unittest_expecting_failure__ = True - if __name__ == '__main__': unittest.main(module=json_format_test, verbosity=2) 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 diff --git a/python/pb_unit_tests/reflection_test_wrapper.py b/python/pb_unit_tests/reflection_test_wrapper.py index b66284862f..b3b115ef92 100644 --- a/python/pb_unit_tests/reflection_test_wrapper.py +++ b/python/pb_unit_tests/reflection_test_wrapper.py @@ -29,8 +29,6 @@ import unittest reflection_test.ByteSizeTest.testRepeatedCompositesDelete.__unittest_expecting_failure__ = True reflection_test.ByteSizeTest.testRepeatedScalarsRemove.__unittest_expecting_failure__ = True reflection_test.ClassAPITest.testMakeClassWithNestedDescriptor.__unittest_expecting_failure__ = True -reflection_test.OptionsTest.testMessageOptions.__unittest_expecting_failure__ = True -reflection_test.OptionsTest.testPackedOptions.__unittest_expecting_failure__ = True reflection_test.Proto2ReflectionTest.testExtensionContainsError.__unittest_expecting_failure__ = True reflection_test.Proto2ReflectionTest.testExtensionDelete.__unittest_expecting_failure__ = True reflection_test.Proto2ReflectionTest.testExtensionFailureModes.__unittest_expecting_failure__ = True @@ -83,7 +81,6 @@ reflection_test.SerializationTest.testInitKwargs.__unittest_expecting_failure__ reflection_test.SerializationTest.testInitRepeatedKwargs.__unittest_expecting_failure__ = True reflection_test.SerializationTest.testInitRequiredForeignKwargs.__unittest_expecting_failure__ = True reflection_test.SerializationTest.testInitRequiredKwargs.__unittest_expecting_failure__ = True -reflection_test.SerializationTest.testMessageSetWireFormat.__unittest_expecting_failure__ = True reflection_test.SerializationTest.testSerializeUninitialized.__unittest_expecting_failure__ = True reflection_test.SerializationTest.testSerializeUninitializedSubMessage.__unittest_expecting_failure__ = True diff --git a/python/pb_unit_tests/text_format_test_wrapper.py b/python/pb_unit_tests/text_format_test_wrapper.py index 67112477a8..75a4eb1ade 100644 --- a/python/pb_unit_tests/text_format_test_wrapper.py +++ b/python/pb_unit_tests/text_format_test_wrapper.py @@ -29,29 +29,17 @@ from google.protobuf.internal import _parameterized sep = _parameterized._SEPARATOR -text_format_test.OnlyWorksWithProto2RightNowTests.testDuplicateMapKey.__unittest_expecting_failure__ = True -text_format_test.OnlyWorksWithProto2RightNowTests.testMapOrderEnforcement.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testMergeLinesGolden.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testParseGolden.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testParseLinesGolden.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testPrintAllFields.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testPrintAllFieldsPointy.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testPrintInIndexOrder.__unittest_expecting_failure__ = True -text_format_test.OnlyWorksWithProto2RightNowTests.testPrintMap.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testPrintMapUsingCppImplementation.__unittest_expecting_failure__ = True text_format_test.OnlyWorksWithProto2RightNowTests.testPrintUnknownFields.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testExtensionInsideAnyMessage.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testParseAllExtensions.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testParseAllowedUnknownExtension.__unittest_expecting_failure__ = True text_format_test.Proto2Tests.testParseGoldenExtensions.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testParseMap.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testParseMessageByFieldNumber.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testParseMessageSet.__unittest_expecting_failure__ = True text_format_test.Proto2Tests.testPrintAllExtensions.__unittest_expecting_failure__ = True text_format_test.Proto2Tests.testPrintAllExtensionsPointy.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testPrintMessageSet.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testPrintMessageSetAsOneLine.__unittest_expecting_failure__ = True -text_format_test.Proto2Tests.testPrintMessageSetByFieldNumber.__unittest_expecting_failure__ = True getattr(text_format_test.TextFormatMessageToStringTests, "testCustomOptions" + sep + "0").__unittest_expecting_failure__ = True getattr(text_format_test.TextFormatMessageToStringTests, "testCustomOptions" + sep + "1").__unittest_expecting_failure__ = True getattr(text_format_test.TextFormatMessageToStringTests, "testPrintUnknownFieldsEmbeddedMessageInBytes" + sep + "0").__unittest_expecting_failure__ = True diff --git a/python/pb_unit_tests/well_known_types_test_wrapper.py b/python/pb_unit_tests/well_known_types_test_wrapper.py index 412865cb13..22a35d5534 100644 --- a/python/pb_unit_tests/well_known_types_test_wrapper.py +++ b/python/pb_unit_tests/well_known_types_test_wrapper.py @@ -27,7 +27,6 @@ from google.protobuf.internal import well_known_types_test import unittest well_known_types_test.AnyTest.testPackDeterministic.__unittest_expecting_failure__ = True -well_known_types_test.StructTest.testStruct.__unittest_expecting_failure__ = True if __name__ == '__main__': unittest.main(module=well_known_types_test, verbosity=2)