Fix lint errors

This commit is contained in:
Christophe Bedard 2019-06-19 15:32:33 +02:00
parent eb8a7e2c26
commit 39d2a9e2e7
5 changed files with 19 additions and 13 deletions

View file

@ -54,8 +54,14 @@ class TestServiceCallback(TraceTestCase):
for node in self._nodes: for node in self._nodes:
test_start_events = self.get_events_with_procname(node, start_events) test_start_events = self.get_events_with_procname(node, start_events)
test_end_events = self.get_events_with_procname(node, end_events) test_end_events = self.get_events_with_procname(node, end_events)
self.assertGreater(len(test_start_events), 0, f'no start_callback events for node: {node}') self.assertGreater(
self.assertGreater(len(test_end_events), 0, f'no end_callback events for node: {node}') len(test_start_events),
0,
f'no start_callback events for node: {node}')
self.assertGreater(
len(test_end_events),
0,
f'no end_callback events for node: {node}')
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -44,7 +44,8 @@ class TestSubscription(TraceTestCase):
self.assertValidQueueDepth(event, 'queue_depth') self.assertValidQueueDepth(event, 'queue_depth')
self.assertStringFieldNotEmpty(event, 'topic_name') self.assertStringFieldNotEmpty(event, 'topic_name')
callback_added_events = self.get_events_with_name('ros2:rclcpp_subscription_callback_added') callback_added_events = self.get_events_with_name(
'ros2:rclcpp_subscription_callback_added')
for event in callback_added_events: for event in callback_added_events:
self.assertValidHandle(event, ['subscription_handle', 'callback']) self.assertValidHandle(event, ['subscription_handle', 'callback'])

View file

@ -16,12 +16,11 @@
import time import time
from typing import Any from typing import Any
from typing import Dict
from typing import List from typing import List
from typing import Union from typing import Union
import unittest import unittest
# from .utils import cleanup_trace from .utils import cleanup_trace
from .utils import DictEvent from .utils import DictEvent
from .utils import get_event_name from .utils import get_event_name
from .utils import get_event_names from .utils import get_event_names
@ -98,8 +97,7 @@ class TraceTestCase(unittest.TestCase):
self.assertProcessNamesExist(self._nodes) self.assertProcessNamesExist(self._nodes)
def tearDown(self): def tearDown(self):
pass cleanup_trace(self._full_path)
# cleanup_trace(self._full_path)
def assertEventsOrderSet(self, event_names: List[str]): def assertEventsOrderSet(self, event_names: List[str]):
""" """
@ -202,7 +200,6 @@ class TraceTestCase(unittest.TestCase):
1, 1,
'matching field event not after initial event') 'matching field event not after initial event')
def assertFieldEquals(self, event: DictEvent, field_name: str, value: Any): def assertFieldEquals(self, event: DictEvent, field_name: str, value: Any):
""" """
Check the value of a field. Check the value of a field.
@ -278,7 +275,7 @@ class TraceTestCase(unittest.TestCase):
events: List[DictEvent] = None events: List[DictEvent] = None
) -> List[DictEvent]: ) -> List[DictEvent]:
""" """
Get all events with the given field:value Get all events with the given field:value.
:param field_name: the name of the field to check :param field_name: the name of the field to check
:param field_value: the value of the field to check :param field_value: the value of the field to check

View file

@ -88,8 +88,10 @@ def cleanup_trace(full_path: str) -> None:
""" """
shutil.rmtree(full_path) shutil.rmtree(full_path)
DictEvent = Dict[str, Any] DictEvent = Dict[str, Any]
def get_trace_events(trace_directory: str) -> List[DictEvent]: def get_trace_events(trace_directory: str) -> List[DictEvent]:
""" """
Get the events of a trace. Get the events of a trace.