Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature requests: isolated testings (with ROS_DOMAIN_ID) #432

Open
huweiATgithub opened this issue Dec 28, 2024 · 1 comment
Open

Feature requests: isolated testings (with ROS_DOMAIN_ID) #432

huweiATgithub opened this issue Dec 28, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@huweiATgithub
Copy link
Contributor

Feature request

Feature description

The LaunchTestRunner or the LaunchROSTestItem should support running in an isolated environment like what ros2 test do: https://github.com/ros2/ros_testing/blob/a60a6d11b5761288f2238651ee4f48c3b99ad373/ros2test/ros2test/command/test.py#L39-L50
 

Implementation considerations

Suggested by the implementation in ros2test, we can write the runtest member function of the class LaunchROSTestItem as follows:

    def runtest(self):
        with contextlib.ExitStack() as stack:
            if "ROS_DOMAIN_ID" not in os.environ:
                domain_id = stack.enter_context(domain_coordinator.domain_id())
                os.environ["ROS_DOMAIN_ID"] = str(domain_id)
            if "ROS_DOMAIN_ID" in os.environ:
                print(f"ROS_DOMAIN_ID: {os.environ['ROS_DOMAIN_ID']}")
            return super().runtest()

To offer this feature as an option, we can supply arguments to the pytest mark

@pytest.mark.rostest(isolated=True)

I can submit a pull request implementing this feature if the proposal is approved.

@cottsay
Copy link
Member

cottsay commented Jan 16, 2025

I think this would be a great addition to launch_ros, and look forward to seeing a pull request implementing it.

Thanks!

@cottsay cottsay added enhancement New feature or request help wanted Extra attention is needed labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants