2424from launch import LaunchDescription
2525from launch import LaunchService
2626from launch .actions import ExecuteProcess
27+ from launch .actions import SetEnvironmentVariable
2728
2829from launch_ros .actions import Node
2930
3233import launch_testing .asserts
3334import launch_testing .markers
3435import launch_testing .tools
36+ from launch_testing_ros .actions import EnableRmwIsolation
3537import launch_testing_ros .tools
3638
3739import pytest
@@ -55,21 +57,22 @@ def generate_test_description(rmw_implementation: str) -> Tuple[LaunchDescriptio
5557 path_to_fixtures = os .path .join (os .path .dirname (__file__ ), 'fixtures' )
5658 additional_env = get_rmw_additional_env (rmw_implementation )
5759 additional_env ['PYTHONUNBUFFERED' ] = '1'
60+ set_env_actions = [SetEnvironmentVariable (k , v ) for k , v in additional_env .items ()]
5861
5962 return LaunchDescription ([
6063 ExecuteProcess (
6164 cmd = ['ros2' , 'daemon' , 'stop' ],
6265 name = 'daemon-stop' ,
6366 on_exit = [
67+ * set_env_actions ,
68+ EnableRmwIsolation (),
6469 ExecuteProcess (
6570 cmd = ['ros2' , 'daemon' , 'start' ],
6671 name = 'daemon-start' ,
67- additional_env = additional_env ,
6872 on_exit = [
6973 Node (
7074 executable = sys .executable ,
7175 arguments = [os .path .join (path_to_fixtures , 'report_node.py' )],
72- additional_env = additional_env
7376 ),
7477 launch_testing .actions .ReadyToTest ()
7578 ]
@@ -100,11 +103,8 @@ def launch_doctor_command(
100103 self ,
101104 arguments
102105 ) -> Generator [launch_testing .tools .process .ProcessProxy , None , None ]:
103- additional_env = get_rmw_additional_env (rmw_implementation )
104- additional_env ['PYTHONUNBUFFERED' ] = '1'
105106 doctor_command_action = ExecuteProcess (
106107 cmd = ['ros2' , 'doctor' , * arguments ],
107- additional_env = additional_env ,
108108 name = 'ros2doctor-cli' ,
109109 output = 'screen'
110110 )
0 commit comments