aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/google/protobuf/internal/reflection_test.py
diff options
context:
space:
mode:
authorGravatar Dan O'Reilly <oreilldf@gmail.com>2015-08-15 10:07:38 -0400
committerGravatar Dan O'Reilly <oreilldf@gmail.com>2015-08-15 10:07:38 -0400
commit3083d8cee7ec3233bbac8feeb23b4ccc74b5bf99 (patch)
tree94ff4b9e8ce46355b34c441367cb3b380e1e9327 /python/google/protobuf/internal/reflection_test.py
parent7601551f7c967da66f0ae1d20fcdd23d77c46b95 (diff)
Fix --cpp_implementation test failure. Test both pure Python and cpp implementation in tox.
Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
Diffstat (limited to 'python/google/protobuf/internal/reflection_test.py')
-rwxr-xr-xpython/google/protobuf/internal/reflection_test.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
index 8967dc2e..1a162272 100755
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -1647,18 +1647,18 @@ class ReflectionTest(unittest.TestCase):
file_descriptor_proto.name = another_file_name
m2 = file_descriptor_proto.message_type.add()
m2.name = 'msg2'
- try:
+ with self.assertRaises(TypeError) as cm:
descriptor.FileDescriptor(
another_file_name,
package_name,
serialized_pb=file_descriptor_proto.SerializeToString())
- except TypeError as e:
- message = str(e)
- else:
- self.fail("Did not raise TypeError")
-
- self.assertTrue('test_file_descriptor_errors.msg1' in message)
- self.assertTrue('test_file_descriptor_errors.proto' in message)
+ self.assertTrue(hasattr(cm, 'exception'), '%s not raised' %
+ getattr(cm.expected, '__name__', cm.expected))
+ self.assertIn('test_file_descriptor_errors.proto', str(cm.exception))
+ # Error message will say something about this definition being a
+ # duplicate, though we don't check the message exactly to avoid a
+ # dependency on the C++ logging code.
+ self.assertIn('test_file_descriptor_errors.msg1', str(cm.exception))
def testStringUTF8Encoding(self):
proto = unittest_pb2.TestAllTypes()