bt2: fix error message in trace_class.py
[babeltrace.git] / tests / bindings / python / bt2 / test_trace_class.py
index 4c2941da8f5aa1eddc038c5d1b1ce8fd787dcd74..bd80586cfbc03393215fc98b2e7b4ff9f3884ddc 100644 (file)
@@ -69,6 +69,14 @@ class TraceClassTestCase(unittest.TestCase):
 
         self.assertRaisesInComponentInit(TypeError, f)
 
+    def test_create_invalid_automatic_stream_class_id_type(self):
+        def f(comp_self):
+            return comp_self._create_trace_class(
+                assigns_automatic_stream_class_id='perchaude'
+            )
+
+        self.assertRaisesInComponentInit(TypeError, f)
+
     def test_automatic_stream_class_id(self):
         def f(comp_self):
             return comp_self._create_trace_class(assigns_automatic_stream_class_id=True)
@@ -218,7 +226,7 @@ class TraceClassTestCase(unittest.TestCase):
 
         with self.assertRaisesRegex(
             ValueError,
-            r'This trace class destruction listener does not match the trace object\.',
+            r'This trace class destruction listener does not match the trace class object\.',
         ):
             trace_class_2.remove_destruction_listener(handle1)
 
@@ -236,6 +244,15 @@ class TraceClassTestCase(unittest.TestCase):
         ):
             trace_class.remove_destruction_listener(handle)
 
+    def test_raise_in_destruction_listener(self):
+        def on_trace_class_destruction(trace_class):
+            raise ValueError('it hurts')
+
+        trace_class = get_default_trace_class()
+        trace_class.add_destruction_listener(on_trace_class_destruction)
+
+        del trace_class
+
 
 if __name__ == '__main__':
     unittest.main()
This page took 0.025586 seconds and 4 git commands to generate.