Skip to content

Commit 8f06ed9

Browse files
authored
Update launch test for change related to enviroment variables in launch (ros2#354)
Since ros2/launch#601, launch no longer modifies os.environ. Rather, it updates a dictionary owned by the launch context, which is then passed to launched executables. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
1 parent 09403de commit 8f06ed9

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

test/test_logging_long_messages.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from launch import LaunchDescription
1919
from launch.actions import ExecuteProcess
20+
from launch.actions import SetEnvironmentVariable
2021

2122
import launch_testing
2223
import launch_testing.actions
@@ -28,15 +29,20 @@
2829
def generate_test_description():
2930
launch_description = LaunchDescription()
3031
# Set the output format to a "verbose" format that is expected by the executable output
31-
os.environ['RCUTILS_CONSOLE_OUTPUT_FORMAT'] = \
32-
'[{severity}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})'
32+
launch_description.add_action(
33+
SetEnvironmentVariable(
34+
name='RCUTILS_CONSOLE_OUTPUT_FORMAT',
35+
value='[{severity}] [{name}]: {message} '
36+
'({function_name}() at {file_name}:{line_number})'
37+
)
38+
)
3339
executable = os.path.join(os.getcwd(), 'test_logging_long_messages')
3440
if os.name == 'nt':
3541
executable += '.exe'
3642
process_name = 'test_logging_long_messages'
37-
launch_description.add_action(ExecuteProcess(
38-
cmd=[executable], name=process_name, output='screen'
39-
))
43+
launch_description.add_action(
44+
ExecuteProcess(cmd=[executable], name=process_name, output='screen')
45+
)
4046

4147
launch_description.add_action(
4248
launch_testing.actions.ReadyToTest()

0 commit comments

Comments
 (0)