bt2: print error causes in bt2._Error.__str__
[babeltrace.git] / tests / bindings / python / bt2 / test_error.py
index 821d30f5a25b485edfbc1b58c43d6b44f1cde620..0bdd6ce3673a2c92c434299507bf6bd464307c77 100644 (file)
@@ -205,6 +205,15 @@ class ErrorTestCase(unittest.TestCase):
         self.assertEqual(cause.component_class_name, 'SourceWithFailingIter')
         self.assertIsNone(cause.plugin_name)
 
+    def test_str(self):
+        # Test __str__.  We don't need to test the precise format used, but
+        # just that it doesn't miserably crash and that it contains some
+        # expected bits.
+        exc = self._run_failing_graph(SourceWithFailingIter, SinkWithExceptionChaining)
+        s = str(exc)
+        self.assertIn('[src (out): src.SourceWithFailingIter]', s)
+        self.assertIn('ValueError: oops', s)
+
 
 if __name__ == '__main__':
     unittest.main()
This page took 0.02519 seconds and 4 git commands to generate.