diff --git a/launch/launch/actions/timer_action.py b/launch/launch/actions/timer_action.py index 4129026c7..5485a199c 100644 --- a/launch/launch/actions/timer_action.py +++ b/launch/launch/actions/timer_action.py @@ -95,7 +95,7 @@ def __init__( 'passing a string literal was deprecated', stacklevel=2) self.__period = type_utils.normalize_typed_substitution(period, float) - self.__actions = actions + self.__actions = list(actions) self.__context_locals: Dict[Text, Any] = {} self.__canceled = False diff --git a/launch/test/launch/test_timer_action.py b/launch/test/launch/test_timer_action.py index abbb11d99..a9f505a37 100644 --- a/launch/test/launch/test_timer_action.py +++ b/launch/test/launch/test_timer_action.py @@ -34,6 +34,15 @@ from launch.substitutions import PythonExpression +def test_timer_action_materializes_action_iterables(): + action = LogInfo(msg='timer action') + timer = TimerAction(period=1.0, actions=iter([action])) + + described_actions = timer.describe_conditional_sub_entities()[0][1] + assert list(described_actions) == [action] + assert list(timer.actions) == [action] + + def test_timer_action_can_capture_the_environment(): """Test that timer actions capture the environment variables present when executed.""" # Regression test for https://github.com/ros2/launch_ros/issues/376