Extract base path constant

This commit is contained in:
Christophe Bedard 2019-06-03 11:39:37 +02:00
parent d6fec8171c
commit 6296fc0016
5 changed files with 10 additions and 15 deletions

View file

@ -5,8 +5,8 @@ from tracetools_test.utils import (
cleanup_trace, cleanup_trace,
) )
BASE_PATH = '/tmp'
PKG = 'tracetools_test' PKG = 'tracetools_test'
node_creation_events = [ node_creation_events = [
'ros2:rcl_init', 'ros2:rcl_init',
'ros2:rcl_node_init', 'ros2:rcl_node_init',
@ -16,10 +16,9 @@ class TestNode(unittest.TestCase):
def test_creation(self): def test_creation(self):
session_name_prefix = 'session-test-node-creation' session_name_prefix = 'session-test-node-creation'
base_path = '/tmp'
test_node = ['test_publisher'] test_node = ['test_publisher']
exit_code, full_path = run_and_trace(base_path, session_name_prefix, node_creation_events, None, PKG, test_node) exit_code, full_path = run_and_trace(BASE_PATH, session_name_prefix, node_creation_events, None, PKG, test_node)
self.assertEqual(exit_code, 0) self.assertEqual(exit_code, 0)
trace_events = get_trace_event_names(full_path) trace_events = get_trace_event_names(full_path)

View file

@ -5,8 +5,8 @@ from tracetools_test.utils import (
cleanup_trace, cleanup_trace,
) )
BASE_PATH = '/tmp'
PKG = 'tracetools_test' PKG = 'tracetools_test'
publisher_creation_events = [ publisher_creation_events = [
'ros2:rcl_publisher_init', 'ros2:rcl_publisher_init',
] ]
@ -15,10 +15,9 @@ class TestPublisher(unittest.TestCase):
def test_creation(self): def test_creation(self):
session_name_prefix = 'session-test-publisher-creation' session_name_prefix = 'session-test-publisher-creation'
base_path = '/tmp'
test_node = ['test_publisher'] test_node = ['test_publisher']
exit_code, full_path = run_and_trace(base_path, session_name_prefix, publisher_creation_events, None, PKG, test_node) exit_code, full_path = run_and_trace(BASE_PATH, session_name_prefix, publisher_creation_events, None, PKG, test_node)
self.assertEqual(exit_code, 0) self.assertEqual(exit_code, 0)
trace_events = get_trace_event_names(full_path) trace_events = get_trace_event_names(full_path)

View file

@ -5,8 +5,8 @@ from tracetools_test.utils import (
cleanup_trace, cleanup_trace,
) )
BASE_PATH = '/tmp'
PKG = 'tracetools_test' PKG = 'tracetools_test'
subscription_creation_events = [ subscription_creation_events = [
'ros2:rcl_subscription_init', 'ros2:rcl_subscription_init',
'ros2:rclcpp_subscription_callback_added', 'ros2:rclcpp_subscription_callback_added',
@ -16,10 +16,9 @@ class TestSubscription(unittest.TestCase):
def test_creation(self): def test_creation(self):
session_name_prefix = 'session-test-subscription-creation' session_name_prefix = 'session-test-subscription-creation'
base_path = '/tmp'
test_node = ['test_subscription'] test_node = ['test_subscription']
exit_code, full_path = run_and_trace(base_path, session_name_prefix, subscription_creation_events, None, PKG, test_node) exit_code, full_path = run_and_trace(BASE_PATH, session_name_prefix, subscription_creation_events, None, PKG, test_node)
self.assertEqual(exit_code, 0) self.assertEqual(exit_code, 0)
trace_events = get_trace_event_names(full_path) trace_events = get_trace_event_names(full_path)

View file

@ -5,8 +5,8 @@ from tracetools_test.utils import (
cleanup_trace, cleanup_trace,
) )
BASE_PATH = '/tmp'
PKG = 'tracetools_test' PKG = 'tracetools_test'
subscription_callback_events = [ subscription_callback_events = [
'ros2:rclcpp_subscription_callback_start', 'ros2:rclcpp_subscription_callback_start',
'ros2:rclcpp_subscription_callback_end', 'ros2:rclcpp_subscription_callback_end',
@ -16,10 +16,9 @@ class TestSubscriptionCallback(unittest.TestCase):
def test_callback(self): def test_callback(self):
session_name_prefix = 'session-test-subscription-callback' session_name_prefix = 'session-test-subscription-callback'
base_path = '/tmp'
test_nodes = ['test_ping', 'test_pong'] 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) exit_code, full_path = run_and_trace(BASE_PATH, session_name_prefix, subscription_callback_events, None, PKG, test_nodes)
self.assertEqual(exit_code, 0) self.assertEqual(exit_code, 0)
trace_events = get_trace_event_names(full_path) trace_events = get_trace_event_names(full_path)

View file

@ -5,8 +5,8 @@ from tracetools_test.utils import (
cleanup_trace, cleanup_trace,
) )
BASE_PATH = '/tmp'
PKG = 'tracetools_test' PKG = 'tracetools_test'
timer_events = [ timer_events = [
'ros2:rcl_timer_init', 'ros2:rcl_timer_init',
'ros2:rclcpp_timer_callback_added', 'ros2:rclcpp_timer_callback_added',
@ -18,10 +18,9 @@ class TestTimer(unittest.TestCase):
def test_all(self): def test_all(self):
session_name_prefix = 'session-test-timer-all' session_name_prefix = 'session-test-timer-all'
base_path = '/tmp'
test_nodes = ['test_timer'] test_nodes = ['test_timer']
exit_code, full_path = run_and_trace(base_path, session_name_prefix, timer_events, None, PKG, test_nodes) exit_code, full_path = run_and_trace(BASE_PATH, session_name_prefix, timer_events, None, PKG, test_nodes)
self.assertEqual(exit_code, 0) self.assertEqual(exit_code, 0)
trace_events = get_trace_event_names(full_path) trace_events = get_trace_event_names(full_path)