Merge pull request #476 from haberman/python-fixes

Two small Python fixes
pull/13171/head
Joshua Haberman 3 years ago committed by GitHub
commit 0dca22a426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      bazel/protobuf.patch
  2. 5
      python/descriptor.c
  3. 3
      python/pb_unit_tests/BUILD
  4. 1
      python/pb_unit_tests/descriptor_pool_test_wrapper.py
  5. 1
      python/pb_unit_tests/descriptor_test_wrapper.py
  6. 2
      python/pb_unit_tests/generator_test_wrapper.py
  7. 7
      python/pb_unit_tests/json_format_test_wrapper.py
  8. 8
      python/pb_unit_tests/message_test_wrapper.py
  9. 3
      python/pb_unit_tests/reflection_test_wrapper.py
  10. 12
      python/pb_unit_tests/text_format_test_wrapper.py
  11. 1
      python/pb_unit_tests/well_known_types_test_wrapper.py

@ -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 '

@ -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);

@ -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,
)

@ -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

@ -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

@ -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)

@ -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)

@ -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

@ -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

@ -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

@ -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)

Loading…
Cancel
Save