pass
@staticmethod
- def _user_query(priv_executor, obj, params):
+ def _user_query(priv_executor, obj, params, method_obj):
raise ValueError('Query is failing')
def test_current_thread_error_none(self):
# When a bt2._Error is raised, it steals the current thread's error.
# Verify that it is now NULL.
- exc = self._run_failing_graph(SourceWithFailingInit, WorkingSink)
+ self._run_failing_graph(SourceWithFailingInit, WorkingSink)
self.assertIsNone(native_bt.current_thread_take_error())
def test_len(self):
self.assertEqual(cause.component_class_type, bt2.ComponentClassType.SOURCE)
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()