Skip to content

Commit 022fe15

Browse files
committed
Enable RMW isolation for ros2doctor.test_report.
Signed-off-by: Tomoya Fujita <[email protected]>
1 parent b032efe commit 022fe15

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ros2doctor/test/test_report.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from launch import LaunchDescription
2525
from launch import LaunchService
2626
from launch.actions import ExecuteProcess
27+
from launch.actions import SetEnvironmentVariable
2728

2829
from launch_ros.actions import Node
2930

@@ -32,6 +33,7 @@
3233
import launch_testing.asserts
3334
import launch_testing.markers
3435
import launch_testing.tools
36+
from launch_testing_ros.actions import EnableRmwIsolation
3537
import launch_testing_ros.tools
3638

3739
import 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

Comments
 (0)