ros2 / launch

Tools for launching multiple processes and for writing tests involving multiple processes.
Apache License 2.0
128 stars 144 forks source link

Python 3.10: launch_testing has a warning of "There is no current event loop" #613

Open clalancette opened 2 years ago

clalancette commented 2 years ago

Bug report

Required Info:

Steps to reproduce issue

$ . /opt/ros/humble/setup.bash
$ mkdir -p jsp_ws/src
$ cd jsp_ws
$ git clone https://github.com/ros/joint_state_publisher -b ros2 src/joint_state_publisher
$ colcon build
$ colcon test

Expected behavior

Tests run and succeed without warning

Actual behavior

Tests run, and succeed, but have warnings like:

=============================== warnings summary ===============================
test/test_64_joint_robot.py: 2 warnings
test/test_mimic_chain.py: 2 warnings
test/test_mimic_cycle.py: 2 warnings
test/test_multi_joints.py: 2 warnings
test/test_zero_joints.py: 2 warnings
  Warning: There is no current event loop

Additional information

This seems to be a change in Python 3.10. In particular, I think that calling get_event_loop without a loop running is now an error. See https://github.com/pytest-dev/pytest-asyncio/issues/212 for some explanation of this. We probably need fixes in launch, launch_ros, and osrf_pycommon (at least).

austin-InDro commented 1 year ago

I have also seen this error in my tests