From 1618ed7842f6a36c598e4b9dd814f61c64b34f90 Mon Sep 17 00:00:00 2001 From: Mikael Arguedas Date: Sat, 5 Aug 2017 00:26:53 -0700 Subject: [PATCH] pep8 + import order (#157) --- composition/test/test_composition.py.in | 7 ++++--- demo_nodes_cpp/test/test_executables_tutorial.py.in | 2 ++ image_tools/test/test_executables_demo.py.in | 1 + intra_process_demo/test/test_executables_demo.py.in | 2 ++ pendulum_control/test/test_pendulum_demo.py.in | 10 +++++++--- pendulum_control/test/test_pendulum_teleop.py.in | 10 +++++++--- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/composition/test/test_composition.py.in b/composition/test/test_composition.py.in index cf03bf14b..cd0be70f5 100644 --- a/composition/test/test_composition.py.in +++ b/composition/test/test_composition.py.in @@ -48,11 +48,13 @@ def test_dlopen_composition(): server_library = '@SERVER_LIBRARY@' client_library = '@CLIENT_LIBRARY@' output_file = '@EXPECTED_OUTPUT_ALL@' - launch(name, [executable, talker_library, listener_library, server_library, client_library], output_file) + launch( + name, + [executable, talker_library, listener_library, server_library, client_library], + output_file) def test_api_pubsub_composition(): - import sys name = 'test_api_composition' executable = '@API_COMPOSITION_EXECUTABLE@' additional_processes = [ @@ -76,7 +78,6 @@ def test_api_pubsub_composition(): def test_api_srv_composition(): - import sys name = 'test_api_composition' executable = '@API_COMPOSITION_EXECUTABLE@' additional_processes = [ diff --git a/demo_nodes_cpp/test/test_executables_tutorial.py.in b/demo_nodes_cpp/test/test_executables_tutorial.py.in index ca38a94ce..94c7a8024 100644 --- a/demo_nodes_cpp/test/test_executables_tutorial.py.in +++ b/demo_nodes_cpp/test/test_executables_tutorial.py.in @@ -2,6 +2,7 @@ # generated code does not contain a copyright notice import os + from launch import LaunchDescriptor from launch.exit_handler import ignore_exit_handler from launch.exit_handler import primary_ignore_returncode_exit_handler @@ -58,5 +59,6 @@ def test_executable(): for handler in output_handlers: handler.check() + if __name__ == '__main__': test_executable() diff --git a/image_tools/test/test_executables_demo.py.in b/image_tools/test/test_executables_demo.py.in index aec46d070..0df4277a4 100644 --- a/image_tools/test/test_executables_demo.py.in +++ b/image_tools/test/test_executables_demo.py.in @@ -94,5 +94,6 @@ def _test_executables(publisher_executable_args, subscriber_executable_args): for handler in output_handlers: handler.check() + if __name__ == '__main__': test_reliable_qos() diff --git a/intra_process_demo/test/test_executables_demo.py.in b/intra_process_demo/test/test_executables_demo.py.in index 9fdc8b34b..56a7e9ebc 100644 --- a/intra_process_demo/test/test_executables_demo.py.in +++ b/intra_process_demo/test/test_executables_demo.py.in @@ -2,6 +2,7 @@ # generated code does not contain a copyright notice import os + from launch import LaunchDescriptor from launch.exit_handler import ignore_exit_handler from launch.launcher import DefaultLauncher @@ -43,5 +44,6 @@ def test_executable(): for handler in output_handlers: handler.check() + if __name__ == '__main__': test_executable() diff --git a/pendulum_control/test/test_pendulum_demo.py.in b/pendulum_control/test/test_pendulum_demo.py.in index cdc0a1a8c..f0ef54f76 100644 --- a/pendulum_control/test/test_pendulum_demo.py.in +++ b/pendulum_control/test/test_pendulum_demo.py.in @@ -25,8 +25,10 @@ def test_executable(): pendulum_logger_executable = '@RCLCPP_DEMO_PENDULUM_LOGGER_EXECUTABLE@' pendulum_logger_output_file = '@RCLCPP_DEMO_PENDULUM_LOGGER_EXPECTED_OUTPUT@' pendulum_logger_name = 'pendulum_logger' - pendulum_logger_handler = create_handler(pendulum_logger_name, launch_descriptor, pendulum_logger_output_file) - assert pendulum_logger_handler, 'Cannot find appropriate handler for %s' % pendulum_logger_output_file + pendulum_logger_handler = create_handler( + pendulum_logger_name, launch_descriptor, pendulum_logger_output_file) + assert pendulum_logger_handler, \ + 'Cannot find appropriate handler for %s' % pendulum_logger_output_file output_handlers.append(pendulum_logger_handler) launch_descriptor.add_process( cmd=[pendulum_logger_executable], @@ -51,7 +53,8 @@ def test_executable(): pendulum_demo_name, launch_descriptor, pendulum_demo_output_file, filtered_prefixes=filtered_prefixes, filtered_rmw_implementation=rmw_implementation) - assert pendulum_demo_handler, 'Cannot find appropriate handler for %s' % pendulum_demo_output_file + assert pendulum_demo_handler, \ + 'Cannot find appropriate handler for %s' % pendulum_demo_output_file output_handlers.append(pendulum_demo_handler) launch_descriptor.add_process( cmd=[pendulum_demo_executable, '-i', '1000'], @@ -70,5 +73,6 @@ def test_executable(): for handler in output_handlers: handler.check() + if __name__ == '__main__': test_executable() diff --git a/pendulum_control/test/test_pendulum_teleop.py.in b/pendulum_control/test/test_pendulum_teleop.py.in index 3d329fcc3..94f5f6d27 100644 --- a/pendulum_control/test/test_pendulum_teleop.py.in +++ b/pendulum_control/test/test_pendulum_teleop.py.in @@ -26,8 +26,10 @@ def test_executable(): pendulum_demo_executable = '@RCLCPP_DEMO_PENDULUM_DEMO_EXECUTABLE@' pendulum_demo_output_file = '@RCLCPP_DEMO_PENDULUM_DEMO_TELEOP_EXPECTED_OUTPUT@' pendulum_demo_name = 'pendulum_demo' - pendulum_demo_handler = create_handler(pendulum_demo_name, launch_descriptor, pendulum_demo_output_file) - assert pendulum_demo_handler, 'Cannot find appropriate handler for %s' % pendulum_demo_output_file + pendulum_demo_handler = create_handler( + pendulum_demo_name, launch_descriptor, pendulum_demo_output_file) + assert pendulum_demo_handler, \ + 'Cannot find appropriate handler for %s' % pendulum_demo_output_file output_handlers.append(pendulum_demo_handler) launch_descriptor.add_process( cmd=[pendulum_demo_executable, '-i', '0'], @@ -52,7 +54,8 @@ def test_executable(): pendulum_teleop_name, launch_descriptor, pendulum_teleop_output_file, filtered_prefixes=filtered_prefixes, filtered_rmw_implementation=rmw_implementation) - assert pendulum_teleop_handler, 'Cannot find appropriate handler for %s' % pendulum_teleop_output_file + assert pendulum_teleop_handler, \ + 'Cannot find appropriate handler for %s' % pendulum_teleop_output_file output_handlers.append(pendulum_teleop_handler) execute_with_delay_command = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'execute_with_delay.py') @@ -75,5 +78,6 @@ def test_executable(): for handler in output_handlers: handler.check() + if __name__ == '__main__': test_executable()