Add assertNumEvents method and use assertFieldEquals

This commit is contained in:
Christophe Bedard 2019-06-23 12:56:50 +02:00
parent 4b1545ccb4
commit 0abddffeff
7 changed files with 52 additions and 41 deletions

View file

@ -38,13 +38,12 @@ class TestServiceCallback(TraceTestCase):
start_events = self.get_events_with_name('ros2:callback_start')
for event in start_events:
self.assertValidHandle(event, 'callback')
is_intra_process_value = self.get_field(event, 'is_intra_process')
self.assertIsInstance(is_intra_process_value, int, 'is_intra_process not int')
# Should not be 1 for services (yet)
self.assertEqual(
is_intra_process_value,
self.assertFieldEquals(
event,
'is_intra_process',
0,
f'invalid value for is_intra_process: {is_intra_process_value}')
'invalid value for is_intra_process')
end_events = self.get_events_with_name('ros2:callback_end')
for event in end_events: