moveit2
The MoveIt Motion Planning Framework for ROS 2.
unittest_trajectory_generator_common.test.py
Go to the documentation of this file.
1 import launch_testing
2 import pytest
3 import unittest
4 
5 from launch import LaunchDescription
6 from launch_ros.actions import Node
7 from launch_testing.util import KeepAliveProc
8 
9 import sys
10 import os
11 
12 sys.path.append(os.path.dirname(__file__))
13 from common_parameters import load_moveit_config, load_yaml
14 
15 
16 @pytest.mark.rostest
18 
19  # Load the context
20  test_config = load_moveit_config()
21 
22  test_param = load_yaml(
23  "pilz_industrial_motion_planner",
24  "config/unittest_trajectory_generator_common.yaml",
25  )
26 
27  # run test
28  unittest_trajectory_generator_common = Node(
29  package="pilz_industrial_motion_planner",
30  executable="unittest_trajectory_generator_common",
31  name="unittest_trajectory_generator_common",
32  parameters=[
33  test_config.to_dict(),
34  test_param,
35  ],
36  output="screen",
37  )
38  return (
39  LaunchDescription(
40  [
41  unittest_trajectory_generator_common,
42  KeepAliveProc(),
43  launch_testing.actions.ReadyToTest(),
44  ]
45  ),
46  {"unittest_trajectory_generator_common": unittest_trajectory_generator_common},
47  )
48 
49 
50 class TestTerminatingProcessStops(unittest.TestCase):
51  def test_gtest_run_complete(self, proc_info, unittest_trajectory_generator_common):
52  proc_info.assertWaitForShutdown(
53  process=unittest_trajectory_generator_common, timeout=4000.0
54  )
55 
56 
57 @launch_testing.post_shutdown_test()
58 class TestOutcome(unittest.TestCase):
59  def test_exit_codes(self, proc_info, unittest_trajectory_generator_common):
60  launch_testing.asserts.assertExitCodes(
61  proc_info, process=unittest_trajectory_generator_common
62  )
def test_exit_codes(self, proc_info, unittest_trajectory_generator_common)
def test_gtest_run_complete(self, proc_info, unittest_trajectory_generator_common)
def load_yaml(package_name, file_path)