Commit 3083d8ce authored by Dan O'Reilly's avatar Dan O'Reilly

Fix --cpp_implementation test failure. Test both pure Python and cpp implementation in tox.

Signed-off-by: 's avatarDan O'Reilly <oreilldf@gmail.com>
parent 7601551f
...@@ -1647,18 +1647,18 @@ class ReflectionTest(unittest.TestCase): ...@@ -1647,18 +1647,18 @@ class ReflectionTest(unittest.TestCase):
file_descriptor_proto.name = another_file_name file_descriptor_proto.name = another_file_name
m2 = file_descriptor_proto.message_type.add() m2 = file_descriptor_proto.message_type.add()
m2.name = 'msg2' m2.name = 'msg2'
try: with self.assertRaises(TypeError) as cm:
descriptor.FileDescriptor( descriptor.FileDescriptor(
another_file_name, another_file_name,
package_name, package_name,
serialized_pb=file_descriptor_proto.SerializeToString()) serialized_pb=file_descriptor_proto.SerializeToString())
except TypeError as e: self.assertTrue(hasattr(cm, 'exception'), '%s not raised' %
message = str(e) getattr(cm.expected, '__name__', cm.expected))
else: self.assertIn('test_file_descriptor_errors.proto', str(cm.exception))
self.fail("Did not raise TypeError") # Error message will say something about this definition being a
# duplicate, though we don't check the message exactly to avoid a
self.assertTrue('test_file_descriptor_errors.msg1' in message) # dependency on the C++ logging code.
self.assertTrue('test_file_descriptor_errors.proto' in message) self.assertIn('test_file_descriptor_errors.msg1', str(cm.exception))
def testStringUTF8Encoding(self): def testStringUTF8Encoding(self):
proto = unittest_pb2.TestAllTypes() proto = unittest_pb2.TestAllTypes()
......
...@@ -11,5 +11,6 @@ commands = ...@@ -11,5 +11,6 @@ commands =
python setup.py -q --cpp_implementation develop python setup.py -q --cpp_implementation develop
python setup.py build_py python setup.py build_py
python setup.py -q test -q python setup.py -q test -q
python setup.py -q test -q --cpp_implementation
deps = deps =
six six
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment