bt2: make bt2.Error wrap current thread's error
[babeltrace.git] / tests / bindings / python / bt2 / test_query_executor.py
index f313b173b6bc5c83c3046b108fb59e4a47cfe855..9f57f30b32e47d7eec82c1171266cb2aa1c773f1 100644 (file)
@@ -97,9 +97,17 @@ class QueryExecutorTestCase(unittest.TestCase):
             def _query(cls, query_exec, obj, params, log_level):
                 raise ValueError
 
-        with self.assertRaises(bt2.Error):
+        with self.assertRaises(bt2.Error) as ctx:
             res = bt2.QueryExecutor().query(MySink, 'obj', [17, 23])
 
+        exc = ctx.exception
+        self.assertEqual(len(exc), 1)
+        cause = exc[0]
+        self.assertIsInstance(cause, bt2.error._ComponentClassErrorCause)
+        self.assertIn('raise ValueError', cause.message)
+        self.assertEqual(cause.component_class_type, bt2.ComponentClassType.SINK)
+        self.assertEqual(cause.component_class_name, 'MySink')
+
     def test_query_invalid_object(self):
         class MySink(bt2._UserSinkComponent):
             def _consume(self):
This page took 0.025174 seconds and 4 git commands to generate.