Last active
January 11, 2022 23:00
-
-
Save Aposhian/cf1efc55311711649ad9c3b3e91f4c88 to your computer and use it in GitHub Desktop.
Can't use event-triggered ReadyToTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ros:galactic | |
COPY setup.sh . | |
COPY launch.test.py . | |
RUN . /opt/ros/$ROS_DISTRO/setup.sh && python3 -m launch_testing.launch_test launch.test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import pytest | |
from launch import LaunchDescription | |
from launch.actions import ExecuteProcess, RegisterEventHandler | |
from launch.event_handlers import OnProcessExit | |
from launch_testing.actions import ReadyToTest | |
@pytest.mark.launch_test | |
def generate_test_description(): | |
setup = ExecuteProcess(cmd=["setup.sh"], output="screen") | |
return ( | |
LaunchDescription( | |
[ | |
setup, | |
RegisterEventHandler( | |
OnProcessExit(target_action=setup, on_exit=ReadyToTest()) | |
), | |
] | |
), | |
{"setup": setup}, | |
) | |
class TestTeachAndRepeat(unittest.TestCase): | |
def test_relying_on_setup(self, launch_service, proc_output): | |
print("Running the test!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Doing complicated setup logic" | |
sleep 10 | |
echo "I'm done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment