Update style for test_subscription_callback

This commit is contained in:
Christophe Bedard 2019-11-16 15:27:08 -08:00
parent a5739a099c
commit bb509e672c

View file

@ -42,14 +42,14 @@ class TestSubscriptionCallback(TraceTestCase):
self.assertIsInstance(is_intra_process_value, int, 'is_intra_process not int') self.assertIsInstance(is_intra_process_value, int, 'is_intra_process not int')
self.assertTrue( self.assertTrue(
is_intra_process_value in [0, 1], is_intra_process_value in [0, 1],
f'invalid value for is_intra_process: {is_intra_process_value}') f'invalid value for is_intra_process: {is_intra_process_value}',
)
end_events = self.get_events_with_name('ros2:callback_end') end_events = self.get_events_with_name('ros2:callback_end')
for event in end_events: for event in end_events:
self.assertValidHandle(event, 'callback') self.assertValidHandle(event, 'callback')
# Check that a start:end pair has a common callback handle # Check that a start:end pair has a common callback handle
# Note: might be unstable if tracing is disabled too early
ping_events = self.get_events_with_procname('test_ping') ping_events = self.get_events_with_procname('test_ping')
pong_events = self.get_events_with_procname('test_pong') pong_events = self.get_events_with_procname('test_pong')
ping_events_start = self.get_events_with_name('ros2:callback_start', ping_events) ping_events_start = self.get_events_with_name('ros2:callback_start', ping_events)
@ -59,13 +59,15 @@ class TestSubscriptionCallback(TraceTestCase):
ping_start, ping_start,
'callback', 'callback',
'ros2:callback_end', 'ros2:callback_end',
ping_events) ping_events,
)
for pong_start in pong_events_start: for pong_start in pong_events_start:
self.assertMatchingField( self.assertMatchingField(
pong_start, pong_start,
'callback', 'callback',
'ros2:callback_end', 'ros2:callback_end',
pong_events) pong_events,
)
if __name__ == '__main__': if __name__ == '__main__':