This patch fixes and enables test_query_executor.py.
The only important change is in the query method: it is necessary to
check for `is_canceled` prior to calling the API function, since it
asserts that the executor is not cancelled.
I have removed the __eq__ method and tests, since it's quite unlikely to
be useful for the QueryExecutor class.
Change-Id: If88c2552627358b06f7d6068126034a20ebf88e8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1252
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
return is_canceled > 0
def query(self, component_class, object, params=None):
+ if self.is_canceled:
+ raise bt2.QueryExecutorCanceled
+
if not isinstance(component_class, bt2.component._GenericComponentClass):
err = False
self._handle_status(status, 'cannot query component class')
assert(result_ptr)
return bt2.value._create_from_ptr(result_ptr)
-
- def __eq__(self, other):
- if type(other) is not type(self):
- return False
-
- return self.addr == other.addr
import bt2
-@unittest.skip("this is broken")
class QueryExecutorTestCase(unittest.TestCase):
def test_query(self):
class MySink(bt2._UserSinkComponent):
with self.assertRaises(bt2.QueryExecutorCanceled):
res = query_exec.query(MySink, 'obj', [17, 23])
-
- def test_eq(self):
- query_exec = bt2.QueryExecutor()
- self.assertEqual(query_exec, query_exec)
-
- def test_eq_invalid(self):
- query_exec = bt2.QueryExecutor()
- self.assertNotEqual(query_exec, 23)