Extract common testcase class
This commit is contained in:
parent
cc3c142f9f
commit
05d60cb57a
9 changed files with 194 additions and 223 deletions
|
@ -14,39 +14,23 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from tracetools_test.utils import (
|
||||
cleanup_trace,
|
||||
get_trace_event_names,
|
||||
run_and_trace,
|
||||
)
|
||||
|
||||
BASE_PATH = '/tmp'
|
||||
PKG = 'tracetools_test'
|
||||
publisher_creation_events = [
|
||||
'ros2:rcl_publisher_init',
|
||||
]
|
||||
from tracetools_test.case import TraceTestCase
|
||||
|
||||
|
||||
class TestPublisher(unittest.TestCase):
|
||||
class TestPublisher(TraceTestCase):
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
super().__init__(
|
||||
*args,
|
||||
session_name_prefix='session-test-publisher-creation',
|
||||
events_ros=[
|
||||
'ros2:rcl_publisher_init',
|
||||
],
|
||||
nodes=['test_publisher']
|
||||
)
|
||||
|
||||
def test_creation(self):
|
||||
session_name_prefix = 'session-test-publisher-creation'
|
||||
test_node = ['test_publisher']
|
||||
|
||||
exit_code, full_path = run_and_trace(
|
||||
BASE_PATH,
|
||||
session_name_prefix,
|
||||
publisher_creation_events,
|
||||
None,
|
||||
PKG,
|
||||
test_node)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
trace_events = get_trace_event_names(full_path)
|
||||
print(f'trace_events: {trace_events}')
|
||||
self.assertSetEqual(set(publisher_creation_events), trace_events)
|
||||
|
||||
cleanup_trace(full_path)
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue