Update style in test_publisher
This commit is contained in:
parent
3c3a575c80
commit
ff4155ab84
1 changed files with 14 additions and 7 deletions
|
@ -39,7 +39,8 @@ class TestPublisher(TraceTestCase):
|
||||||
for event in pub_init_events:
|
for event in pub_init_events:
|
||||||
self.assertValidHandle(
|
self.assertValidHandle(
|
||||||
event,
|
event,
|
||||||
['publisher_handle', 'node_handle', 'rmw_publisher_handle'])
|
['publisher_handle', 'node_handle', 'rmw_publisher_handle'],
|
||||||
|
)
|
||||||
self.assertValidQueueDepth(event, 'queue_depth')
|
self.assertValidQueueDepth(event, 'queue_depth')
|
||||||
self.assertStringFieldNotEmpty(event, 'topic_name')
|
self.assertStringFieldNotEmpty(event, 'topic_name')
|
||||||
|
|
||||||
|
@ -48,11 +49,13 @@ class TestPublisher(TraceTestCase):
|
||||||
test_pub_init_topic_events = self.get_events_with_field_value(
|
test_pub_init_topic_events = self.get_events_with_field_value(
|
||||||
'topic_name',
|
'topic_name',
|
||||||
'/the_topic',
|
'/the_topic',
|
||||||
test_pub_init_events)
|
test_pub_init_events,
|
||||||
|
)
|
||||||
self.assertNumEventsEqual(
|
self.assertNumEventsEqual(
|
||||||
test_pub_init_topic_events,
|
test_pub_init_topic_events,
|
||||||
1,
|
1,
|
||||||
'none or more than 1 pub_init even for test topic')
|
'none or more than 1 rcl_pub_init even for test topic',
|
||||||
|
)
|
||||||
|
|
||||||
# Check queue_depth value
|
# Check queue_depth value
|
||||||
test_pub_init_topic_event = test_pub_init_topic_events[0]
|
test_pub_init_topic_event = test_pub_init_topic_events[0]
|
||||||
|
@ -60,23 +63,27 @@ class TestPublisher(TraceTestCase):
|
||||||
test_pub_init_topic_event,
|
test_pub_init_topic_event,
|
||||||
'queue_depth',
|
'queue_depth',
|
||||||
10,
|
10,
|
||||||
'pub_init event does not have expected queue depth value')
|
'pub_init event does not have expected queue depth value',
|
||||||
|
)
|
||||||
|
|
||||||
# Check that the node handle matches with the node_init event
|
# Check that the node handle matches with the node_init event
|
||||||
node_init_events = self.get_events_with_name('ros2:rcl_node_init')
|
node_init_events = self.get_events_with_name('ros2:rcl_node_init')
|
||||||
test_pub_node_init_events = self.get_events_with_procname(
|
test_pub_node_init_events = self.get_events_with_procname(
|
||||||
'test_publisher',
|
'test_publisher',
|
||||||
node_init_events)
|
node_init_events,
|
||||||
|
)
|
||||||
self.assertNumEventsEqual(
|
self.assertNumEventsEqual(
|
||||||
test_pub_node_init_events,
|
test_pub_node_init_events,
|
||||||
1,
|
1,
|
||||||
'none or more than 1 node_init event')
|
'none or more than 1 node_init event',
|
||||||
|
)
|
||||||
test_pub_node_init_event = test_pub_node_init_events[0]
|
test_pub_node_init_event = test_pub_node_init_events[0]
|
||||||
self.assertMatchingField(
|
self.assertMatchingField(
|
||||||
test_pub_node_init_event,
|
test_pub_node_init_event,
|
||||||
'node_handle',
|
'node_handle',
|
||||||
None,
|
None,
|
||||||
test_pub_init_events)
|
test_pub_init_events,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue