From ef65537cb921a034c6b187d9d7cbe4b3a3103ab0 Mon Sep 17 00:00:00 2001 From: texhnolyze Date: Thu, 12 Dec 2024 19:07:37 +0100 Subject: [PATCH] test(colcon): configure our pkgs to use `pytest` to ensure that the CI `colcon test` run works, because with a change to python 3.12 the `unittest` standard library used by default with colcon now exits with an error code of 5 for an empty test suite. See: https://github.com/colcon/colcon-core/issues/678 See: https://github.com/python/cpython/pull/102051 --- bitbots_behavior/bitbots_body_behavior/package.xml | 1 + bitbots_behavior/bitbots_body_behavior/setup.py | 4 ++-- bitbots_misc/bitbots_technical_challenge_vision/setup.py | 1 + bitbots_misc/bitbots_teleop/package.xml | 2 ++ bitbots_misc/bitbots_teleop/setup.py | 1 + bitbots_misc/bitbots_tts/package.xml | 4 +++- bitbots_misc/bitbots_tts/setup.py | 3 ++- bitbots_misc/system_monitor/package.xml | 9 ++++++--- bitbots_misc/system_monitor/setup.py | 3 ++- bitbots_motion/bitbots_animation_rqt/package.xml | 2 ++ bitbots_motion/bitbots_animation_rqt/setup.py | 3 ++- bitbots_motion/bitbots_animation_server/package.xml | 2 ++ bitbots_motion/bitbots_animation_server/setup.py | 1 + bitbots_simulation/bitbots_robocup_api/package.xml | 2 ++ bitbots_simulation/bitbots_robocup_api/setup.py | 3 ++- .../bitbots_team_communication/setup.py | 4 +--- .../bitbots_team_data_sim_rqt/package.xml | 2 ++ .../bitbots_team_data_sim_rqt/setup.py | 3 ++- bitbots_vision/package.xml | 2 ++ bitbots_vision/setup.py | 1 + bitbots_world_model/bitbots_ball_filter/package.xml | 2 ++ bitbots_world_model/bitbots_ball_filter/setup.py | 1 + bitbots_world_model/bitbots_robot_filter/setup.py | 4 ++-- scripts/ros.plugin.sh | 1 + 24 files changed, 45 insertions(+), 16 deletions(-) diff --git a/bitbots_behavior/bitbots_body_behavior/package.xml b/bitbots_behavior/bitbots_body_behavior/package.xml index b660e9c5a..6a12bc9ce 100644 --- a/bitbots_behavior/bitbots_body_behavior/package.xml +++ b/bitbots_behavior/bitbots_body_behavior/package.xml @@ -30,6 +30,7 @@ tf_transformations tf2 + python3-pytest diff --git a/bitbots_behavior/bitbots_body_behavior/setup.py b/bitbots_behavior/bitbots_body_behavior/setup.py index 2b535daae..097ec5c5b 100644 --- a/bitbots_behavior/bitbots_body_behavior/setup.py +++ b/bitbots_behavior/bitbots_body_behavior/setup.py @@ -1,13 +1,13 @@ import glob -from setuptools import setup +from setuptools import find_packages, setup package_name = "bitbots_body_behavior" setup( name=package_name, - packages=[package_name], + packages=find_packages(exclude=["test"]), data_files=[ ("share/" + package_name, ["package.xml"]), ("share/ament_index/resource_index/packages", ["resource/" + package_name]), diff --git a/bitbots_misc/bitbots_technical_challenge_vision/setup.py b/bitbots_misc/bitbots_technical_challenge_vision/setup.py index 4603d372c..cfe0915aa 100644 --- a/bitbots_misc/bitbots_technical_challenge_vision/setup.py +++ b/bitbots_misc/bitbots_technical_challenge_vision/setup.py @@ -16,6 +16,7 @@ ("share/" + package_name + "/launch", glob.glob("launch/*.launch")), ], install_requires=["setuptools"], + tests_require=["pytest"], zip_safe=True, maintainer="par", maintainer_email="paer-wiegmann@gmx.de", diff --git a/bitbots_misc/bitbots_teleop/package.xml b/bitbots_misc/bitbots_teleop/package.xml index 298625eab..15aad8159 100644 --- a/bitbots_misc/bitbots_teleop/package.xml +++ b/bitbots_misc/bitbots_teleop/package.xml @@ -20,6 +20,8 @@ std_msgs tf_transformations + python3-pytest + python2 diff --git a/bitbots_misc/bitbots_teleop/setup.py b/bitbots_misc/bitbots_teleop/setup.py index 0e1db4322..148552ede 100644 --- a/bitbots_misc/bitbots_teleop/setup.py +++ b/bitbots_misc/bitbots_teleop/setup.py @@ -19,6 +19,7 @@ "launch", "setuptools", ], + tests_require=["pytest"], zip_safe=True, keywords=["ROS"], license="MIT", diff --git a/bitbots_misc/bitbots_tts/package.xml b/bitbots_misc/bitbots_tts/package.xml index 096597d26..f0a86a2cc 100644 --- a/bitbots_misc/bitbots_tts/package.xml +++ b/bitbots_misc/bitbots_tts/package.xml @@ -11,7 +11,7 @@ Hamburg Bit-Bots MIT - + Marc Bestmann ament_cmake @@ -21,6 +21,8 @@ espeak std_msgs + python3-pytest + broken diff --git a/bitbots_misc/bitbots_tts/setup.py b/bitbots_misc/bitbots_tts/setup.py index 29cedacd8..9d702643b 100644 --- a/bitbots_misc/bitbots_tts/setup.py +++ b/bitbots_misc/bitbots_tts/setup.py @@ -6,7 +6,7 @@ setup( name=package_name, - packages=find_packages(), + packages=find_packages(exclude=["test"]), data_files=[ ("share/" + package_name, ["package.xml"]), ("share/ament_index/resource_index/packages", ["resource/" + package_name]), @@ -16,6 +16,7 @@ install_requires=[ "setuptools", ], + tests_require=["pytest"], scripts=glob.glob("scripts/*"), entry_points={ "console_scripts": [ diff --git a/bitbots_misc/system_monitor/package.xml b/bitbots_misc/system_monitor/package.xml index 46545bde4..4284ff58c 100644 --- a/bitbots_misc/system_monitor/package.xml +++ b/bitbots_misc/system_monitor/package.xml @@ -11,7 +11,7 @@ Hamburg Bit-Bots MIT - + Finn-Thorben Sell ament_cmake @@ -21,7 +21,10 @@ rclpy bitbots_msgs - ament_python + python3-pytest + + + ament_python - + diff --git a/bitbots_misc/system_monitor/setup.py b/bitbots_misc/system_monitor/setup.py index eb10b08e6..0de29d43a 100644 --- a/bitbots_misc/system_monitor/setup.py +++ b/bitbots_misc/system_monitor/setup.py @@ -6,7 +6,7 @@ setup( name=package_name, - packages=find_packages(), + packages=find_packages(exclude=["test"]), data_files=[ ("share/" + package_name, ["package.xml"]), ("share/ament_index/resource_index/packages", ["resource/" + package_name]), @@ -18,6 +18,7 @@ install_requires=[ "setuptools", ], + tests_require=["pytest"], entry_points={ "console_scripts": [ "monitor = system_monitor.monitor:main", diff --git a/bitbots_motion/bitbots_animation_rqt/package.xml b/bitbots_motion/bitbots_animation_rqt/package.xml index aec6962c0..40019b786 100644 --- a/bitbots_motion/bitbots_animation_rqt/package.xml +++ b/bitbots_motion/bitbots_animation_rqt/package.xml @@ -22,6 +22,8 @@ rqt_gui std_srvs + python3-pytest + diff --git a/bitbots_motion/bitbots_animation_rqt/setup.py b/bitbots_motion/bitbots_animation_rqt/setup.py index ff22687d2..639dc194a 100644 --- a/bitbots_motion/bitbots_animation_rqt/setup.py +++ b/bitbots_motion/bitbots_animation_rqt/setup.py @@ -4,7 +4,7 @@ setup( name=package_name, - packages=find_packages(), + packages=find_packages(exclude=["test"]), data_files=[ ("share/" + package_name + "/resource", ["resource/RecordUI.ui"]), ("share/ament_index/resource_index/packages", ["resource/" + package_name]), @@ -12,6 +12,7 @@ ("share/" + package_name, ["plugin.xml"]), ], install_requires=["setuptools"], + tests_require=["pytest"], zip_safe=True, entry_points={ "console_scripts": [ diff --git a/bitbots_motion/bitbots_animation_server/package.xml b/bitbots_motion/bitbots_animation_server/package.xml index 5552f2810..77427c8ef 100644 --- a/bitbots_motion/bitbots_animation_server/package.xml +++ b/bitbots_motion/bitbots_animation_server/package.xml @@ -22,6 +22,8 @@ rclpy std_msgs + python3-pytest + tested_integration diff --git a/bitbots_motion/bitbots_animation_server/setup.py b/bitbots_motion/bitbots_animation_server/setup.py index c93d21760..c41689c5f 100644 --- a/bitbots_motion/bitbots_animation_server/setup.py +++ b/bitbots_motion/bitbots_animation_server/setup.py @@ -18,6 +18,7 @@ "launch", "setuptools", ], + tests_require=["pytest"], zip_safe=True, keywords=["ROS"], license="MIT", diff --git a/bitbots_simulation/bitbots_robocup_api/package.xml b/bitbots_simulation/bitbots_robocup_api/package.xml index b7b2c2954..3d390044e 100644 --- a/bitbots_simulation/bitbots_robocup_api/package.xml +++ b/bitbots_simulation/bitbots_robocup_api/package.xml @@ -29,6 +29,8 @@ topic_tools rosbag2 + python3-pytest + ament_python diff --git a/bitbots_simulation/bitbots_robocup_api/setup.py b/bitbots_simulation/bitbots_robocup_api/setup.py index 94fdf23af..2ab578e4e 100644 --- a/bitbots_simulation/bitbots_robocup_api/setup.py +++ b/bitbots_simulation/bitbots_robocup_api/setup.py @@ -7,7 +7,7 @@ setup( name=package_name, - packages=find_packages(), + packages=find_packages(exclude=["test"]), data_files=[ ("share/ament_index/resource_index/packages", ["resource/" + package_name]), (os.path.join("share", package_name), ["package.xml"]), @@ -18,6 +18,7 @@ "launch", "setuptools", ], + tests_require=["pytest"], zip_safe=True, keywords=["ROS"], license="MIT", diff --git a/bitbots_team_communication/bitbots_team_communication/setup.py b/bitbots_team_communication/bitbots_team_communication/setup.py index c7defe03d..e84961b43 100644 --- a/bitbots_team_communication/bitbots_team_communication/setup.py +++ b/bitbots_team_communication/bitbots_team_communication/setup.py @@ -8,7 +8,5 @@ install_requires=[ "setuptools", ], - extras_require={ - "dev": ["pytest", "syrupy"], - }, + tests_require=["pytest", "syrupy"], ) diff --git a/bitbots_team_communication/bitbots_team_data_sim_rqt/package.xml b/bitbots_team_communication/bitbots_team_data_sim_rqt/package.xml index f62e2a73e..529c50300 100644 --- a/bitbots_team_communication/bitbots_team_data_sim_rqt/package.xml +++ b/bitbots_team_communication/bitbots_team_data_sim_rqt/package.xml @@ -22,6 +22,8 @@ rqt_gui std_srvs + python3-pytest + diff --git a/bitbots_team_communication/bitbots_team_data_sim_rqt/setup.py b/bitbots_team_communication/bitbots_team_data_sim_rqt/setup.py index a0f3e44aa..65fc7a504 100644 --- a/bitbots_team_communication/bitbots_team_data_sim_rqt/setup.py +++ b/bitbots_team_communication/bitbots_team_data_sim_rqt/setup.py @@ -4,7 +4,7 @@ setup( name=package_name, - packages=find_packages(), + packages=find_packages(exclude=["test"]), data_files=[ ("share/" + package_name + "/resource", ["resource/RobotTeamDataSimulator.ui"]), ("share/ament_index/resource_index/packages", ["resource/" + package_name]), @@ -12,6 +12,7 @@ ("share/" + package_name, ["plugin.xml"]), ], install_requires=["setuptools"], + tests_require=["pytest"], zip_safe=True, entry_points={ "console_scripts": [ diff --git a/bitbots_vision/package.xml b/bitbots_vision/package.xml index 740a5ded8..752e2fc74 100644 --- a/bitbots_vision/package.xml +++ b/bitbots_vision/package.xml @@ -40,6 +40,8 @@ std_msgs vision_opencv + python3-pytest + python3 diff --git a/bitbots_vision/setup.py b/bitbots_vision/setup.py index 2e24e1962..96b053d04 100755 --- a/bitbots_vision/setup.py +++ b/bitbots_vision/setup.py @@ -23,6 +23,7 @@ "launch", "setuptools", ], + tests_require=["pytest"], zip_safe=True, keywords=["ROS"], license="MIT", diff --git a/bitbots_world_model/bitbots_ball_filter/package.xml b/bitbots_world_model/bitbots_ball_filter/package.xml index 7c3cf3f1b..554e655e3 100644 --- a/bitbots_world_model/bitbots_ball_filter/package.xml +++ b/bitbots_world_model/bitbots_ball_filter/package.xml @@ -23,6 +23,8 @@ std_srvs tf2_geometry_msgs + python3-pytest + python3 diff --git a/bitbots_world_model/bitbots_ball_filter/setup.py b/bitbots_world_model/bitbots_ball_filter/setup.py index 56e0df152..c98cbb296 100644 --- a/bitbots_world_model/bitbots_ball_filter/setup.py +++ b/bitbots_world_model/bitbots_ball_filter/setup.py @@ -24,6 +24,7 @@ "launch", "setuptools", ], + tests_require=["pytest"], zip_safe=True, keywords=["ROS"], license="MIT", diff --git a/bitbots_world_model/bitbots_robot_filter/setup.py b/bitbots_world_model/bitbots_robot_filter/setup.py index 3c1d1b074..ce4c50c38 100644 --- a/bitbots_world_model/bitbots_robot_filter/setup.py +++ b/bitbots_world_model/bitbots_robot_filter/setup.py @@ -1,13 +1,13 @@ import glob -from setuptools import setup +from setuptools import find_packages, setup package_name = "bitbots_robot_filter" setup( name=package_name, version="0.0.0", - packages=[package_name], + packages=find_packages(exclude=["test"]), data_files=[ ("share/ament_index/resource_index/packages", ["resource/" + package_name]), ("share/" + package_name, ["package.xml"]), diff --git a/scripts/ros.plugin.sh b/scripts/ros.plugin.sh index 6ba9f121c..3fe2f1096 100644 --- a/scripts/ros.plugin.sh +++ b/scripts/ros.plugin.sh @@ -54,6 +54,7 @@ alias cbs='cdc && colcon build --symlink-install --packages-select' alias cb='cdc && colcon build --symlink-install --continue-on-error --packages-up-to' alias cc='cdc && colcon clean packages --packages-select' alias cca='cdc && colcon clean packages' +alias ct='cdc && colcon test --event-handlers console_direct+ --return-code-on-test-failure' alias sr="source /opt/ros/$distro/setup.$shell && update_ros2_argcomplete" alias sc="source \$COLCON_WS/install/setup.$shell && update_ros2_argcomplete"