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 · 0 comments
Open

Feature requests: isolated testings (with ROS_DOMAIN_ID) #432

huweiATgithub opened this issue Dec 28, 2024 · 0 comments
Assignees

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants