Fix tests by splitting them into two separate files
This commit is contained in:
parent
8f09ce339d
commit
39bd95b51f
3 changed files with 34 additions and 19 deletions
|
@ -60,6 +60,7 @@ if(BUILD_TESTING)
|
||||||
test/test_node.py
|
test/test_node.py
|
||||||
test/test_publisher.py
|
test/test_publisher.py
|
||||||
test/test_subscription.py
|
test/test_subscription.py
|
||||||
|
test/test_subscription_callback.py
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(_test_path ${_tracetools_test_pytest_tests})
|
foreach(_test_path ${_tracetools_test_pytest_tests})
|
||||||
|
|
|
@ -12,11 +12,6 @@ subscription_creation_events = [
|
||||||
'ros2:rclcpp_subscription_callback_added',
|
'ros2:rclcpp_subscription_callback_added',
|
||||||
]
|
]
|
||||||
|
|
||||||
subscription_callback_events = [
|
|
||||||
'ros2:rclcpp_subscription_callback_start',
|
|
||||||
'ros2:rclcpp_subscription_callback_end',
|
|
||||||
]
|
|
||||||
|
|
||||||
class TestSubscription(unittest.TestCase):
|
class TestSubscription(unittest.TestCase):
|
||||||
|
|
||||||
def test_creation(self):
|
def test_creation(self):
|
||||||
|
@ -33,20 +28,6 @@ class TestSubscription(unittest.TestCase):
|
||||||
|
|
||||||
cleanup_trace(full_path)
|
cleanup_trace(full_path)
|
||||||
|
|
||||||
def test_callback(self):
|
|
||||||
session_name_prefix = 'session-test-subscription-callback'
|
|
||||||
base_path = '/tmp'
|
|
||||||
test_nodes = ['test_ping', 'test_pong']
|
|
||||||
|
|
||||||
exit_code, full_path = run_and_trace(base_path, session_name_prefix, subscription_callback_events, None, PKG, test_nodes)
|
|
||||||
self.assertEqual(exit_code, 0)
|
|
||||||
|
|
||||||
trace_events = get_trace_event_names(full_path)
|
|
||||||
print(f'trace_events: {trace_events}')
|
|
||||||
self.assertSetEqual(set(subscription_callback_events), trace_events)
|
|
||||||
|
|
||||||
cleanup_trace(full_path)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
33
tracetools_test/test/test_subscription_callback.py
Normal file
33
tracetools_test/test/test_subscription_callback.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
import unittest
|
||||||
|
from tracetools_test.utils import (
|
||||||
|
get_trace_event_names,
|
||||||
|
run_and_trace,
|
||||||
|
cleanup_trace,
|
||||||
|
)
|
||||||
|
|
||||||
|
PKG = 'tracetools_test'
|
||||||
|
|
||||||
|
subscription_callback_events = [
|
||||||
|
'ros2:rclcpp_subscription_callback_start',
|
||||||
|
'ros2:rclcpp_subscription_callback_end',
|
||||||
|
]
|
||||||
|
|
||||||
|
class TestSubscriptionCallback(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_callback(self):
|
||||||
|
session_name_prefix = 'session-test-subscription-callback'
|
||||||
|
base_path = '/tmp'
|
||||||
|
test_nodes = ['test_ping', 'test_pong']
|
||||||
|
|
||||||
|
exit_code, full_path = run_and_trace(base_path, session_name_prefix, subscription_callback_events, None, PKG, test_nodes)
|
||||||
|
self.assertEqual(exit_code, 0)
|
||||||
|
|
||||||
|
trace_events = get_trace_event_names(full_path)
|
||||||
|
print(f'trace_events: {trace_events}')
|
||||||
|
self.assertSetEqual(set(subscription_callback_events), trace_events)
|
||||||
|
|
||||||
|
cleanup_trace(full_path)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue