-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #276 from tamird/drop-apputils-dependency
Migrate Python tests to stdlib unittest, drop apputils dependency.
- Loading branch information
Showing
24 changed files
with
132 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,13 +34,14 @@ | |
|
||
__author__ = '[email protected] (Matt Toia)' | ||
|
||
from google.apputils import basetest | ||
import unittest | ||
|
||
from google.protobuf import descriptor_pb2 | ||
from google.protobuf.internal import factory_test2_pb2 | ||
from google.protobuf import descriptor_database | ||
|
||
|
||
class DescriptorDatabaseTest(basetest.TestCase): | ||
class DescriptorDatabaseTest(unittest.TestCase): | ||
|
||
def testAdd(self): | ||
db = descriptor_database.DescriptorDatabase() | ||
|
@@ -62,4 +63,4 @@ def testAdd(self): | |
'google.protobuf.python.internal.MessageWithNestedEnumOnly.NestedEnum')) | ||
|
||
if __name__ == '__main__': | ||
basetest.main() | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,8 @@ | |
__author__ = '[email protected] (Will Robinson)' | ||
|
||
import sys | ||
import unittest | ||
|
||
from google.apputils import basetest | ||
from google.protobuf import unittest_custom_options_pb2 | ||
from google.protobuf import unittest_import_pb2 | ||
from google.protobuf import unittest_pb2 | ||
|
@@ -52,7 +52,7 @@ | |
""" | ||
|
||
|
||
class DescriptorTest(basetest.TestCase): | ||
class DescriptorTest(unittest.TestCase): | ||
|
||
def setUp(self): | ||
file_proto = descriptor_pb2.FileDescriptorProto( | ||
|
@@ -390,7 +390,7 @@ def testFileDescriptor(self): | |
self.assertEqual(self.my_file.name, 'some/filename/some.proto') | ||
self.assertEqual(self.my_file.package, 'protobuf_unittest') | ||
|
||
@basetest.unittest.skipIf( | ||
@unittest.skipIf( | ||
api_implementation.Type() != 'cpp' or api_implementation.Version() != 2, | ||
'Immutability of descriptors is only enforced in v2 implementation') | ||
def testImmutableCppDescriptor(self): | ||
|
@@ -403,7 +403,7 @@ def testImmutableCppDescriptor(self): | |
message_descriptor.fields.append(None) | ||
|
||
|
||
class GeneratedDescriptorTest(basetest.TestCase): | ||
class GeneratedDescriptorTest(unittest.TestCase): | ||
"""Tests for the properties of descriptors in generated code.""" | ||
|
||
def CheckMessageDescriptor(self, message_descriptor): | ||
|
@@ -493,7 +493,7 @@ def testCppDescriptorContainer_Iterator(self): | |
self.assertEqual('FOO', next(values_iter).name) | ||
|
||
|
||
class DescriptorCopyToProtoTest(basetest.TestCase): | ||
class DescriptorCopyToProtoTest(unittest.TestCase): | ||
"""Tests for CopyTo functions of Descriptor.""" | ||
|
||
def _AssertProtoEqual(self, actual_proto, expected_class, expected_ascii): | ||
|
@@ -694,7 +694,7 @@ def testCopyToProto_ServiceDescriptor(self): | |
# TEST_SERVICE_ASCII) | ||
|
||
|
||
class MakeDescriptorTest(basetest.TestCase): | ||
class MakeDescriptorTest(unittest.TestCase): | ||
|
||
def testMakeDescriptorWithNestedFields(self): | ||
file_descriptor_proto = descriptor_pb2.FileDescriptorProto() | ||
|
@@ -776,4 +776,4 @@ def testMakeDescriptorWithOptions(self): | |
options.Extensions[unittest_custom_options_pb2.msgopt].i) | ||
|
||
if __name__ == '__main__': | ||
basetest.main() | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,8 @@ | |
|
||
__author__ = '[email protected] (Will Robinson)' | ||
|
||
from google.apputils import basetest | ||
import unittest | ||
|
||
from google.protobuf.internal import test_bad_identifiers_pb2 | ||
from google.protobuf import unittest_custom_options_pb2 | ||
from google.protobuf import unittest_import_pb2 | ||
|
@@ -55,7 +56,7 @@ | |
MAX_EXTENSION = 536870912 | ||
|
||
|
||
class GeneratorTest(basetest.TestCase): | ||
class GeneratorTest(unittest.TestCase): | ||
|
||
def testNestedMessageDescriptor(self): | ||
field_name = 'optional_nested_message' | ||
|
@@ -291,7 +292,7 @@ def testOneof(self): | |
self.assertIs(desc.oneofs[0], desc.oneofs_by_name['oneof_field']) | ||
nested_names = set(['oneof_uint32', 'oneof_nested_message', | ||
'oneof_string', 'oneof_bytes']) | ||
self.assertSameElements( | ||
self.assertItemsEqual( | ||
nested_names, | ||
[field.name for field in desc.oneofs[0].fields]) | ||
for field_name, field_desc in desc.fields_by_name.iteritems(): | ||
|
@@ -301,7 +302,7 @@ def testOneof(self): | |
self.assertIsNone(field_desc.containing_oneof) | ||
|
||
|
||
class SymbolDatabaseRegistrationTest(basetest.TestCase): | ||
class SymbolDatabaseRegistrationTest(unittest.TestCase): | ||
"""Checks that messages, enums and files are correctly registered.""" | ||
|
||
def testGetSymbol(self): | ||
|
@@ -340,4 +341,4 @@ def testFindFileByName(self): | |
'google/protobuf/unittest.proto').name) | ||
|
||
if __name__ == '__main__': | ||
basetest.main() | ||
unittest.main() |
54 changes: 0 additions & 54 deletions
54
python/google/protobuf/internal/message_factory_python_test.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.