We can use isolated ROS2 partitions to run tests in parallel. This is very useful with pytest-parallel, e.g. when you can run pytest --workers $((2 * $(nproc))). For this, you need to set the ROS_DOMAIN_ID:
import os
import random
if use_random_domain_id:
if "ROS_DOMAIN_ID" in os.environ:
warn("the user about the fact that they already specified it")
os.environ["ROS_DOMAIN_ID"] = str(random.randint(0, 232)) # or maybe more clever?
We can use isolated ROS2 partitions to run tests in parallel. This is very useful with pytest-parallel, e.g. when you can run
pytest --workers $((2 * $(nproc)))
. For this, you need to set theROS_DOMAIN_ID
: