|
15 | 15 | from pathlib import Path |
16 | 16 |
|
17 | 17 | from launch import LaunchContext, LaunchDescription |
18 | | -from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, Log |
19 | | -from launch.utilities import perform_substitutions |
| 18 | +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription |
20 | 19 |
|
21 | 20 | THIS_DIR = Path(__file__).parent |
22 | 21 |
|
23 | 22 |
|
24 | 23 | def test_load_basic(): |
25 | 24 | context = LaunchContext() |
26 | 25 |
|
27 | | - include = IncludeLaunchDescription(THIS_DIR / 'launch' / 'basic_launch.py') |
| 26 | + include = IncludeLaunchDescription(str(THIS_DIR / 'launch' / 'basic_launch.py')) |
| 27 | + print(include) |
28 | 28 | included_entities = include.get_sub_entities() |
| 29 | + print(included_entities) |
| 30 | + assert len(included_entities) == 1 |
| 31 | + |
29 | 32 | launch_desc = included_entities[0] |
30 | 33 | assert isinstance(launch_desc, LaunchDescription) |
31 | 34 |
|
32 | 35 | launchfile_entities = launch_desc.describe_sub_entities() |
33 | 36 | assert len(launchfile_entities) == 2 |
34 | 37 |
|
| 38 | + # The first entity is a declare() |
35 | 39 | should_be_declare = launchfile_entities[0] |
36 | | - should_be_log = launchfile_entities[1] |
37 | | - |
38 | 40 | assert isinstance(should_be_declare, DeclareLaunchArgument) |
39 | 41 | should_be_declare.visit(context) |
40 | 42 |
|
41 | | - assert isinstance(should_be_log, Log) |
42 | | - should_be_log.visit(context) |
| 43 | + # Second is executable() |
| 44 | + should_be_exec = launchfile_entities[1] |
| 45 | + assert isinstance(should_be_exec, ExecuteProcess) |
43 | 46 |
|
44 | | - msg = perform_substitutions(context, should_be_log.msg) |
45 | | - assert msg == 'I am a launch file: foo=bar' |
| 47 | + should_be_exec.prepare(context) |
| 48 | + assert should_be_exec.process_description.final_cmd == ['echo', 'hello world'] |
0 commit comments