moveit2
The MoveIt Motion Planning Framework for ROS 2.
unittest_trajectory_generator_circ.test.py
Go to the documentation of this file.
1 import launch_testing
2 import pytest
3 import unittest
4 from ament_index_python.packages import get_package_share_directory
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_circ.yaml",
25  )
26 
27  testdata_file_name = {
28  "testdata_file_name": get_package_share_directory(
29  "pilz_industrial_motion_planner"
30  )
31  + "/test_data/prbt/testdata_sequence.xml"
32  }
33 
34  # run test
35  unittest_trajectory_generator_circ = Node(
36  package="pilz_industrial_motion_planner",
37  executable="unittest_trajectory_generator_circ",
38  name="unittest_trajectory_generator_circ",
39  parameters=[
40  test_config.to_dict(),
41  test_param,
42  testdata_file_name,
43  ],
44  output="screen",
45  )
46  return (
47  LaunchDescription(
48  [
49  unittest_trajectory_generator_circ,
50  KeepAliveProc(),
51  launch_testing.actions.ReadyToTest(),
52  ]
53  ),
54  {"unittest_trajectory_generator_circ": unittest_trajectory_generator_circ},
55  )
56 
57 
58 class TestTerminatingProcessStops(unittest.TestCase):
59  def test_gtest_run_complete(self, proc_info, unittest_trajectory_generator_circ):
60  proc_info.assertWaitForShutdown(
61  process=unittest_trajectory_generator_circ, timeout=4000.0
62  )
63 
64 
65 @launch_testing.post_shutdown_test()
66 class TestOutcome(unittest.TestCase):
67  def test_exit_codes(self, proc_info, unittest_trajectory_generator_circ):
68  launch_testing.asserts.assertExitCodes(
69  proc_info, process=unittest_trajectory_generator_circ
70  )
def test_exit_codes(self, proc_info, unittest_trajectory_generator_circ)
def test_gtest_run_complete(self, proc_info, unittest_trajectory_generator_circ)
def load_yaml(package_name, file_path)