Update style in test_service
This commit is contained in:
parent
481dbea21b
commit
3fd400d039
1 changed files with 14 additions and 8 deletions
|
@ -37,11 +37,11 @@ class TestService(TraceTestCase):
|
|||
|
||||
# Check fields
|
||||
srv_init_events = self.get_events_with_name('ros2:rcl_service_init')
|
||||
callback_added_events = self.get_events_with_name('ros2:rclcpp_service_callback_added')
|
||||
|
||||
for event in srv_init_events:
|
||||
self.assertValidHandle(event, ['service_handle', 'node_handle', 'rmw_service_handle'])
|
||||
self.assertStringFieldNotEmpty(event, 'service_name')
|
||||
|
||||
callback_added_events = self.get_events_with_name('ros2:rclcpp_service_callback_added')
|
||||
for event in callback_added_events:
|
||||
self.assertValidHandle(event, ['service_handle', 'callback'])
|
||||
|
||||
|
@ -50,27 +50,32 @@ class TestService(TraceTestCase):
|
|||
event_service_names = self.get_events_with_field_value(
|
||||
'service_name',
|
||||
'/the_service',
|
||||
test_srv_init_events)
|
||||
test_srv_init_events,
|
||||
)
|
||||
self.assertGreaterEqual(
|
||||
len(event_service_names),
|
||||
1,
|
||||
'cannot find test service name')
|
||||
'cannot find test service name',
|
||||
)
|
||||
|
||||
# Check that the node handle matches the node_init event
|
||||
node_init_events = self.get_events_with_name('ros2:rcl_node_init')
|
||||
test_srv_node_init_events = self.get_events_with_procname(
|
||||
'test_service',
|
||||
node_init_events)
|
||||
node_init_events,
|
||||
)
|
||||
self.assertNumEventsEqual(
|
||||
test_srv_node_init_events,
|
||||
1,
|
||||
'none or more than 1 node_init event')
|
||||
'none or more than 1 rcl_node_init event',
|
||||
)
|
||||
test_srv_node_init_event = test_srv_node_init_events[0]
|
||||
self.assertMatchingField(
|
||||
test_srv_node_init_event,
|
||||
'node_handle',
|
||||
'ros2:rcl_service_init',
|
||||
test_srv_init_events)
|
||||
test_srv_init_events,
|
||||
)
|
||||
|
||||
# Check that the service handles match
|
||||
test_event_srv_init = event_service_names[0]
|
||||
|
@ -78,7 +83,8 @@ class TestService(TraceTestCase):
|
|||
test_event_srv_init,
|
||||
'service_handle',
|
||||
None,
|
||||
callback_added_events)
|
||||
callback_added_events,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue