moveit2
The MoveIt Motion Planning Framework for ROS 2.
unittest_trajectory_functions.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", "config/unittest_trajectory_functions.yaml"
24  )
25 
26  # run test
27  unittest_trajectory_functions = Node(
28  package="pilz_industrial_motion_planner",
29  executable="unittest_trajectory_functions",
30  name="unittest_trajectory_functions",
31  parameters=[
32  test_config.to_dict(),
33  test_param,
34  ],
35  output="screen",
36  )
37  return (
38  LaunchDescription(
39  [
40  unittest_trajectory_functions,
41  KeepAliveProc(),
42  launch_testing.actions.ReadyToTest(),
43  ]
44  ),
45  {"unittest_trajectory_functions": unittest_trajectory_functions},
46  )
47 
48 
49 class TestTerminatingProcessStops(unittest.TestCase):
50  def test_gtest_run_complete(self, proc_info, unittest_trajectory_functions):
51  proc_info.assertWaitForShutdown(
52  process=unittest_trajectory_functions, timeout=4000.0
53  )
54 
55 
56 @launch_testing.post_shutdown_test()
57 class TestOutcome(unittest.TestCase):
58  def test_exit_codes(self, proc_info, unittest_trajectory_functions):
59  launch_testing.asserts.assertExitCodes(
60  proc_info, process=unittest_trajectory_functions
61  )
def test_exit_codes(self, proc_info, unittest_trajectory_functions)
def test_gtest_run_complete(self, proc_info, unittest_trajectory_functions)
def load_yaml(package_name, file_path)