ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Tools: ros2: Add geopose test

Open Ryanf55 opened this issue 2 years ago • 2 comments

Purpose

  • Add geopose test
  • Add missing deps
  • Reduce some duplication

How to test

source /opt/ros/humble/setup.bash
colcon build --packages-up-to ardupilot_dds_tests
colcon --log-level DEBUG test --packages-select ardupilot_dds_tests --event-handlers=console_direct+

Current problem

Test hangs locally. When hitting ctrl+c, it will slowly kill all the tests, and then you get info:

[242.162s] DEBUG:colcon.colcon_parallel_executor.executor.parallel:run_until_complete was interrupted
[242.162s] DEBUG:colcon.colcon_parallel_executor.executor.parallel:run_until_complete again
test/ardupilot_dds_tests/test_geopose_msg_received.py EE                 [ 44%]
test/ardupilot_dds_tests/test_navsat_msg_received.py EE                  [ 66%]
test/ardupilot_dds_tests/test_time_msg_received.py EE                    [ 88%]
--- Logging error ---                                           
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.10/codecs.py", line 378, in write
    self.stream.write(data)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 304, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 103, in pytest_sessionfinish
    session._setupstate.teardown_all()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 412, in teardown_all
    self._pop_and_teardown()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 387, in _pop_and_teardown
    self._teardown_with_finalization(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 405, in _teardown_with_finalization
    self._callfinalizers(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 395, in _callfinalizers
    fin()
  File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1027, in finish
    func()
  File "/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/fixture.py", line 35, in finalize_launch_service
    rc = loop.run_until_complete(launch_service.task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/signal_management.py", line 209, in __handle_signal
    self.__handlers[signum](signum)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 195, in _on_sigint
    self.__logger.warning(base_msg)
Message: 'user interrupted with ctrl-c (SIGINT)'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.10/codecs.py", line 378, in write
    self.stream.write(data)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 304, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 103, in pytest_sessionfinish
    session._setupstate.teardown_all()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 412, in teardown_all
    self._pop_and_teardown()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 387, in _pop_and_teardown
    self._teardown_with_finalization(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 405, in _teardown_with_finalization
    self._callfinalizers(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 395, in _callfinalizers
    fin()
  File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1027, in finish
    func()
  File "/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/fixture.py", line 35, in finalize_launch_service
    rc = loop.run_until_complete(launch_service.task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 239, in __process_event
    entities = event_handler.handle(event, self.__context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_action_event_base.py", line 112, in handle
    return self.__on_event(event, context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_process_io.py", line 60, in handle
    return on_stderr(event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 653, in <lambda>
    on_stderr=lambda event: on_output_method(
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 405, in __on_process_output_cached
    logger.info(
Message: '[tty1 -4] 2023/11/26 12:15:57 socat[2470027] N socat_signal(): handling signal 2'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.10/codecs.py", line 378, in write
    self.stream.write(data)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 304, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 103, in pytest_sessionfinish
    session._setupstate.teardown_all()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 412, in teardown_all
    self._pop_and_teardown()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 387, in _pop_and_teardown
    self._teardown_with_finalization(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 405, in _teardown_with_finalization
    self._callfinalizers(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 395, in _callfinalizers
    fin()
  File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1027, in finish
    func()
  File "/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/fixture.py", line 35, in finalize_launch_service
    rc = loop.run_until_complete(launch_service.task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 239, in __process_event
    entities = event_handler.handle(event, self.__context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_action_event_base.py", line 112, in handle
    return self.__on_event(event, context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_process_io.py", line 60, in handle
    return on_stderr(event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 653, in <lambda>
    on_stderr=lambda event: on_output_method(
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 405, in __on_process_output_cached
    logger.info(
Message: '[tty1 -4] 2023/11/26 12:15:57 socat[2470027] N exiting on signal 2'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.10/codecs.py", line 378, in write
    self.stream.write(data)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 304, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 103, in pytest_sessionfinish
    session._setupstate.teardown_all()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 412, in teardown_all
    self._pop_and_teardown()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 387, in _pop_and_teardown
    self._teardown_with_finalization(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 405, in _teardown_with_finalization
    self._callfinalizers(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 395, in _callfinalizers
    fin()
  File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1027, in finish
    func()
  File "/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/fixture.py", line 35, in finalize_launch_service
    rc = loop.run_until_complete(launch_service.task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 239, in __process_event
    entities = event_handler.handle(event, self.__context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_action_event_base.py", line 112, in handle
    return self.__on_event(event, context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_process_io.py", line 60, in handle
    return on_stderr(event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 653, in <lambda>
    on_stderr=lambda event: on_output_method(
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 405, in __on_process_output_cached
    logger.info(
Message: '[tty1 -4] 2023/11/26 12:15:57 socat[2470027] N socat_signal(): finishing signal 2'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.10/codecs.py", line 378, in write
    self.stream.write(data)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 304, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 103, in pytest_sessionfinish
    session._setupstate.teardown_all()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 412, in teardown_all
    self._pop_and_teardown()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 387, in _pop_and_teardown
    self._teardown_with_finalization(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 405, in _teardown_with_finalization
    self._callfinalizers(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 395, in _callfinalizers
    fin()
  File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1027, in finish
    func()
  File "/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/fixture.py", line 35, in finalize_launch_service
    rc = loop.run_until_complete(launch_service.task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 239, in __process_event
    entities = event_handler.handle(event, self.__context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_action_event_base.py", line 112, in handle
    return self.__on_event(event, context)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/event_handlers/on_process_io.py", line 60, in handle
    return on_stderr(event)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 653, in <lambda>
    on_stderr=lambda event: on_output_method(
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 405, in __on_process_output_cached
    logger.info(
Message: '[tty1 -4] 2023/11/26 12:15:57 socat[2470027] N exit(130)'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.10/codecs.py", line 378, in write
    self.stream.write(data)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/lib/python3/dist-packages/_pytest/main.py", line 304, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 103, in pytest_sessionfinish
    session._setupstate.teardown_all()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 412, in teardown_all
    self._pop_and_teardown()
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 387, in _pop_and_teardown
    self._teardown_with_finalization(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 405, in _teardown_with_finalization
    self._callfinalizers(colitem)
  File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 395, in _callfinalizers
    fin()
  File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1027, in finish
    func()
  File "/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/fixture.py", line 35, in finalize_launch_service
    rc = loop.run_until_complete(launch_service.task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/execute_local.py", line 573, in __execute_process
    self.__logger.error("process has died [pid {}, exit code {}, cmd '{}'].".format(
Message: "process has died [pid 2470025, exit code -2, cmd 'socat -d -d pty,raw,echo=0,link=/tmp/pytest-of-ryan/pytest-23/devices3/dev/tty0 pty,raw,echo=0,link=/tmp/pytest-of-ryan/pytest-23/devices3/dev/tty1 ']."
Arguments: ()
test/ardupilot_dds_tests/test_virtual_ports.py 

==================================== ERRORS ====================================
______________ ERROR at setup of test_dds_serial_geopose_msg_recv ______________
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:369: in run_until_complete
    loop.run_until_complete(future_like)
/usr/lib/python3.10/asyncio/base_events.py:636: in run_until_complete
    self.run_forever()
/usr/lib/python3.10/asyncio/base_events.py:603: in run_forever
    self._run_once()
/usr/lib/python3.10/asyncio/base_events.py:1871: in _run_once
    event_list = self._selector.select(timeout)
/usr/lib/python3.10/selectors.py:469: in select
    fd_event_list = self._selector.poll(timeout, max_ev)
E   KeyboardInterrupt

During handling of the above exception, another exception occurred:
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:127: in pytest_fixture_setup
    run_until_complete(event_loop, event.wait())
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:371: in run_until_complete
    if future_like.done() and not future_like.cancelled():
E   AttributeError: 'coroutine' object has no attribute 'done'
---------------------------- Captured stdout setup -----------------------------
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-11-26-12-11-34-842941-B650-970-2468184
[INFO] [launch]: Default logging verbosity is set to INFO
command:          socat
tty0:             /tmp/pytest-of-ryan/pytest-23/devices0/dev/tty0
tty1:             /tmp/pytest-of-ryan/pytest-23/devices0/dev/tty1
namespace:        
transport:        serial
middleware:       dds
verbose:          4
discovery:        7400
baudrate:         115200
device:           /tmp/pytest-of-ryan/pytest-23/devices0/dev/tty0
refs:             /home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'micro_ros_agent' not found, searching: ['/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests', '/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl', '/opt/ros/humble']"
[INFO] [tty1 -1]: process started with pid [2468199]
_______________ ERROR at setup of test_dds_udp_geopose_msg_recv ________________
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:369: in run_until_complete
    loop.run_until_complete(future_like)
/usr/lib/python3.10/asyncio/base_events.py:636: in run_until_complete
    self.run_forever()
/usr/lib/python3.10/asyncio/base_events.py:603: in run_forever
    self._run_once()
/usr/lib/python3.10/asyncio/base_events.py:1871: in _run_once
    event_list = self._selector.select(timeout)
/usr/lib/python3.10/selectors.py:469: in select
    fd_event_list = self._selector.poll(timeout, max_ev)
E   KeyboardInterrupt

During handling of the above exception, another exception occurred:
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:127: in pytest_fixture_setup
    run_until_complete(event_loop, event.wait())
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:371: in run_until_complete
    if future_like.done() and not future_like.cancelled():
E   AttributeError: 'coroutine' object has no attribute 'done'
---------------------------- Captured stdout setup -----------------------------
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-11-26-12-11-34-842941-B650-970-2468184
[INFO] [launch]: Default logging verbosity is set to INFO
namespace:        
transport:        udp4
middleware:       dds
verbose:          4
discovery:        7400
port:             2019
refs:             /home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'micro_ros_agent' not found, searching: ['/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests', '/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl', '/opt/ros/humble']"
______________ ERROR at setup of test_dds_serial_navsat_msg_recv _______________
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:369: in run_until_complete
    loop.run_until_complete(future_like)
/usr/lib/python3.10/asyncio/base_events.py:636: in run_until_complete
    self.run_forever()                                        
/usr/lib/python3.10/asyncio/base_events.py:603: in run_forever
    self._run_once()
/usr/lib/python3.10/asyncio/base_events.py:1871: in _run_once
    event_list = self._selector.select(timeout)
/usr/lib/python3.10/selectors.py:469: in select
    fd_event_list = self._selector.poll(timeout, max_ev)
E   KeyboardInterrupt

During handling of the above exception, another exception occurred:
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:127: in pytest_fixture_setup
    run_until_complete(event_loop, event.wait())
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:371: in run_until_complete
    if future_like.done() and not future_like.cancelled():
E   AttributeError: 'coroutine' object has no attribute 'done'
---------------------------- Captured stdout setup -----------------------------
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-11-26-12-11-34-842941-B650-970-2468184
[INFO] [launch]: Default logging verbosity is set to INFO
command:          socat
tty0:             /tmp/pytest-of-ryan/pytest-23/devices1/dev/tty0
tty1:             /tmp/pytest-of-ryan/pytest-23/devices1/dev/tty1
namespace:        
transport:        serial
middleware:       dds
verbose:          4
discovery:        7400
baudrate:         115200
device:           /tmp/pytest-of-ryan/pytest-23/devices1/dev/tty0
refs:             /home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'micro_ros_agent' not found, searching: ['/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests', '/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl', '/opt/ros/humble']"
[INFO] [tty1 -2]: process started with pid [2469811]
________________ ERROR at setup of test_dds_udp_navsat_msg_recv ________________
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:369: in run_until_complete
    loop.run_until_complete(future_like)
/usr/lib/python3.10/asyncio/base_events.py:636: in run_until_complete
    self.run_forever()
/usr/lib/python3.10/asyncio/base_events.py:603: in run_forever
    self._run_once()
/usr/lib/python3.10/asyncio/base_events.py:1871: in _run_once
    event_list = self._selector.select(timeout)
/usr/lib/python3.10/selectors.py:469: in select
    fd_event_list = self._selector.poll(timeout, max_ev)
E   KeyboardInterrupt

During handling of the above exception, another exception occurred:
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:127: in pytest_fixture_setup
    run_until_complete(event_loop, event.wait())
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:371: in run_until_complete
    if future_like.done() and not future_like.cancelled():
E   AttributeError: 'coroutine' object has no attribute 'done'
---------------------------- Captured stdout setup -----------------------------
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-11-26-12-11-34-842941-B650-970-2468184
[INFO] [launch]: Default logging verbosity is set to INFO
namespace:        
transport:        udp4
middleware:       dds
verbose:          4
discovery:        7400
port:             2019
refs:             /home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'micro_ros_agent' not found, searching: ['/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests', '/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl', '/opt/ros/humble']"
_______________ ERROR at setup of test_dds_serial_time_msg_recv ________________
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:369: in run_until_complete
    loop.run_until_complete(future_like)
/usr/lib/python3.10/asyncio/base_events.py:636: in run_until_complete
    self.run_forever()
/usr/lib/python3.10/asyncio/base_events.py:603: in run_forever
    self._run_once()
/usr/lib/python3.10/asyncio/base_events.py:1871: in _run_once
    event_list = self._selector.select(timeout)
/usr/lib/python3.10/selectors.py:469: in select
    fd_event_list = self._selector.poll(timeout, max_ev)
E   KeyboardInterrupt

During handling of the above exception, another exception occurred:
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:127: in pytest_fixture_setup
    run_until_complete(event_loop, event.wait())
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:371: in run_until_complete
    if future_like.done() and not future_like.cancelled():
E   AttributeError: 'coroutine' object has no attribute 'done'
---------------------------- Captured stdout setup -----------------------------
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-11-26-12-11-34-842941-B650-970-2468184
[INFO] [launch]: Default logging verbosity is set to INFO
command:          socat
tty0:             /tmp/pytest-of-ryan/pytest-23/devices2/dev/tty0
tty1:             /tmp/pytest-of-ryan/pytest-23/devices2/dev/tty1
namespace:        
transport:        serial
middleware:       dds
verbose:          4
discovery:        7400
baudrate:         115200
device:           /tmp/pytest-of-ryan/pytest-23/devices2/dev/tty0
refs:             /home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'micro_ros_agent' not found, searching: ['/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests', '/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl', '/opt/ros/humble']"
[INFO] [tty1 -3]: process started with pid [2469867]
_________________ ERROR at setup of test_dds_udp_time_msg_recv _________________
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:369: in run_until_complete
    loop.run_until_complete(future_like)
/usr/lib/python3.10/asyncio/base_events.py:636: in run_until_complete
    self.run_forever()
/usr/lib/python3.10/asyncio/base_events.py:603: in run_forever
    self._run_once()
/usr/lib/python3.10/asyncio/base_events.py:1871: in _run_once
    event_list = self._selector.select(timeout)
/usr/lib/python3.10/selectors.py:469: in select
    fd_event_list = self._selector.poll(timeout, max_ev)
E   KeyboardInterrupt

During handling of the above exception, another exception occurred:
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:127: in pytest_fixture_setup
    run_until_complete(event_loop, event.wait())
/opt/ros/humble/lib/python3.10/site-packages/launch_pytest/plugin.py:371: in run_until_complete
    if future_like.done() and not future_like.cancelled():
E   AttributeError: 'coroutine' object has no attribute 'done'
---------------------------- Captured stdout setup -----------------------------
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-11-26-12-11-34-842941-B650-970-2468184
[INFO] [launch]: Default logging verbosity is set to INFO
namespace:        
transport:        udp4
middleware:       dds
verbose:          4
discovery:        7400
port:             2019
refs:             /home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'micro_ros_agent' not found, searching: ['/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests', '/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl', '/opt/ros/humble']"
- generated xml file: /home/ryan/Dev/ros2_ws/src/ardupilot/build/ardupilot_dds_tests/pytest.xml -
=========================== short test summary info ============================
ERROR test/ardupilot_dds_tests/test_geopose_msg_received.py::test_dds_serial_geopose_msg_recv
ERROR test/ardupilot_dds_tests/test_geopose_msg_received.py::test_dds_udp_geopose_msg_recv
ERROR test/ardupilot_dds_tests/test_navsat_msg_received.py::test_dds_serial_navsat_msg_recv
ERROR test/ardupilot_dds_tests/test_navsat_msg_received.py::test_dds_udp_navsat_msg_recv
ERROR test/ardupilot_dds_tests/test_time_msg_received.py::test_dds_serial_time_msg_recv
ERROR test/ardupilot_dds_tests/test_time_msg_received.py::test_dds_udp_time_msg_recv
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.10/selectors.py:469: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
=================== 2 passed, 6 errors in 263.47s (0:04:23) ====================
[264.418s] DEBUG:colcon.colcon_core.event_handler.log_command:Invoked command in '/home/ryan/Dev/ros2_ws/src/ardupilot/Tools/ros2/ardupilot_dds_tests' returned '2': AMENT_PREFIX_PATH=/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests:/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl:${AMENT_PREFIX_PATH} CMAKE_PREFIX_PATH=/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl PATH=/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/bin:${PATH} PYTEST_ADDOPTS=--tb=short --junit-xml=/home/ryan/Dev/ros2_ws/src/ardupilot/build/ardupilot_dds_tests/pytest.xml --junit-prefix=ardupilot_dds_tests -o cache_dir=/home/ryan/Dev/ros2_ws/src/ardupilot/build/ardupilot_dds_tests/.pytest_cache PYTHONPATH=/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_dds_tests/lib/python3.10/site-packages:/home/ryan/Dev/ros2_ws/src/ardupilot/install/ardupilot_sitl/local/lib/python3.10/dist-packages:${PYTHONPATH} /usr/bin/python3 -m pytest
Aborted  <<< ardupilot_dds_tests [4min 24s]
[264.428s] DEBUG:colcon.colcon_parallel_executor.executor.parallel:run_until_complete finished
[264.428s] DEBUG:colcon.colcon_parallel_executor.executor.parallel:closing loop
[264.428s] DEBUG:colcon.colcon_parallel_executor.executor.parallel:loop closed
[264.428s] DEBUG:colcon.colcon_core.event_reactor:joining thread

Summary: 0 packages finished [4min 24s]
  1 package aborted: ardupilot_dds_tests
  1 package had stderr output: ardupilot_dds_tests
[264.449s] INFO:colcon.colcon_core.plugin_system:Skipping extension 'colcon_notification.desktop_notification.terminal_notifier': Not used on non-Darwin systems
[264.449s] INFO:colcon.colcon_core.plugin_system:Skipping extension 'colcon_notification.desktop_notification.win32': Not used on non-Windows systems
[264.450s] INFO:colcon.colcon_notification.desktop_notification:Sending desktop notification using 'notify2'
[264.459s] DEBUG:colcon.colcon_core.event_reactor:joined thread

So yea, micro_ros_agent was not found because I forgot to source, but that shouldn't cause the test to hang forever.

Ryanf55 avatar Nov 26 '23 16:11 Ryanf55

Test hangs locally. When hitting ctrl+c, it will slowly kill all the tests, and then you get info:

Is it just the new test that is causing the hang, or all of them?

We already have tests covering best effort and reliable streams, so don't think that is the issue?

topic QoS
ap/time RELIABLE
ap/navsat/navsat0 BEST_EFFORT
ap/geopose/filtered BEST_EFFORT

So yea, micro_ros_agent was not found because I forgot to source, but that shouldn't cause the test to hang forever.

Ah - just saw that tacked to the end. We could add a timeout on each test, otherwise it will just wait for the agent service. Or better, add a condition that the agent be present (and a timeout).

srmainwaring avatar Dec 03 '23 16:12 srmainwaring

Test hangs locally. When hitting ctrl+c, it will slowly kill all the tests, and then you get info:

Is it just the new test that is causing the hang, or all of them?

We already have tests covering best effort and reliable streams, so don't think that is the issue?

topic QoS ap/time RELIABLE ap/navsat/navsat0 BEST_EFFORT ap/geopose/filtered BEST_EFFORT

So yea, micro_ros_agent was not found because I forgot to source, but that shouldn't cause the test to hang forever.

Ah - just saw that tacked to the end. We could add a timeout on each test, otherwise it will just wait for the agent service. Or better, add a condition that the agent be present (and a timeout).

Yea, a timeout would be great. Even with proper directory layout, the geopose test still fails and all the others pass. Locally, running the launch files, I get geopose data. Do you have any idea why that channel is not working when run through colcon test?

Ryanf55 avatar Dec 04 '23 14:12 Ryanf55

Test hangs locally. When hitting ctrl+c, it will slowly kill all the tests, and then you get info:

Is it just the new test that is causing the hang, or all of them?

We already have tests covering best effort and reliable streams, so don't think that is the issue?

topic QoS ap/time RELIABLE ap/navsat/navsat0 BEST_EFFORT ap/geopose/filtered BEST_EFFORT

So yea, micro_ros_agent was not found because I forgot to source, but that shouldn't cause the test to hang forever.

Ah - just saw that tacked to the end. We could add a timeout on each test, otherwise it will just wait for the agent service. Or better, add a condition that the agent be present (and a timeout).

Any recommendations on how to implement the best approach? I'd really like to get better test coverage of this interface in CI.

Ryanf55 avatar Jun 05 '24 14:06 Ryanf55

I got the test to pass locally, there were a few typos. Instead of just checking we got a message, this also checks the position is correct.

Ryanf55 avatar Sep 08 '24 20:09 Ryanf55