Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions test_tf2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ endif()

if (BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(ament_cmake_ros REQUIRED)
find_package(ament_cmake_ros_core REQUIRED)
find_package(builtin_interfaces REQUIRED)
# Work around broken find module in AlmaLinux/RHEL eigen3-devel from PowerTools repo
Expand All @@ -34,7 +35,7 @@ if (BUILD_TESTING)

ament_find_gtest()

ament_add_gtest(buffer_core_test test/buffer_core_test.cpp)
ament_add_ros_isolated_gtest(buffer_core_test test/buffer_core_test.cpp)
if(TARGET buffer_core_test)
target_link_libraries(buffer_core_test
ament_cmake_ros_core::ament_ros_defaults
Expand All @@ -46,7 +47,7 @@ if (BUILD_TESTING)
tf2_ros::tf2_ros)
endif()

ament_add_gtest(test_message_filter test/test_message_filter.cpp)
ament_add_ros_isolated_gtest(test_message_filter test/test_message_filter.cpp)
if(TARGET test_message_filter)
target_link_libraries(test_message_filter
ament_cmake_ros_core::ament_ros_defaults
Expand Down Expand Up @@ -118,7 +119,7 @@ if (BUILD_TESTING)
add_launch_test(test/static_publisher.launch.py)
endif()

ament_add_gtest(test_tf2_bullet test/test_tf2_bullet.cpp)
ament_add_ros_isolated_gtest(test_tf2_bullet test/test_tf2_bullet.cpp)
if(TARGET test_tf2_bullet)
target_link_libraries(test_tf2_bullet
ament_cmake_ros_core::ament_ros_defaults
Expand Down
1 change: 1 addition & 0 deletions test_tf2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<depend>tf2_ros</depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_cmake_ros_core</test_depend>
<test_depend>launch_ros</test_depend>
<test_depend>launch_testing_ament_cmake</test_depend>
Expand Down
22 changes: 11 additions & 11 deletions tf2_ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@ if(BUILD_TESTING)
ament_lint_cmake()
ament_uncrustify(LANGUAGE "c++")

find_package(ament_cmake_gtest REQUIRED)
find_package(ament_cmake_ros REQUIRED)

ament_add_gtest(test_buffer test/test_buffer.cpp)
ament_add_ros_isolated_gtest(test_buffer test/test_buffer.cpp)
target_link_libraries(test_buffer
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
# Used, but not linked to test tf2_ros's exports:
# rclcpp::rclcpp
)

ament_add_gtest(test_buffer_server test/test_buffer_server.cpp)
ament_add_ros_isolated_gtest(test_buffer_server test/test_buffer_server.cpp)
target_link_libraries(test_buffer_server
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
Expand All @@ -166,7 +166,7 @@ if(BUILD_TESTING)
# tf2_msgs::tf2_msgs
)

ament_add_gtest(test_buffer_client test/test_buffer_client.cpp)
ament_add_ros_isolated_gtest(test_buffer_client test/test_buffer_client.cpp)
target_link_libraries(test_buffer_client
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
Expand All @@ -178,7 +178,7 @@ if(BUILD_TESTING)

# Adds a tf2_ros message_filter unittest that uses
# multiple target frames and a non-zero time tolerance
ament_add_gtest(${PROJECT_NAME}_test_message_filter test/message_filter_test.cpp)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test_message_filter test/message_filter_test.cpp)
target_link_libraries(${PROJECT_NAME}_test_message_filter
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
Expand All @@ -188,31 +188,31 @@ if(BUILD_TESTING)
# rclcpp::rclcpp
)

ament_add_gtest(${PROJECT_NAME}_test_transform_listener test/test_transform_listener.cpp)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test_transform_listener test/test_transform_listener.cpp)
target_link_libraries(${PROJECT_NAME}_test_transform_listener
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
# Used, but not linked to test tf2_ros's exports:
# rclcpp::rclcpp
)

ament_add_gtest(${PROJECT_NAME}_test_static_transform_broadcaster test/test_static_transform_broadcaster.cpp)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test_static_transform_broadcaster test/test_static_transform_broadcaster.cpp)
target_link_libraries(${PROJECT_NAME}_test_static_transform_broadcaster
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
# Used, but not linked to test tf2_ros's exports:
# rclcpp::rclcpp
)

ament_add_gtest(${PROJECT_NAME}_test_transform_broadcaster test/test_transform_broadcaster.cpp)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test_transform_broadcaster test/test_transform_broadcaster.cpp)
target_link_libraries(${PROJECT_NAME}_test_transform_broadcaster
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
# Used, but not linked to test tf2_ros's exports:
# rclcpp::rclcpp
)

ament_add_gtest(${PROJECT_NAME}_test_time_reset test/time_reset_test.cpp)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test_time_reset test/time_reset_test.cpp)
target_link_libraries(${PROJECT_NAME}_test_time_reset
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
Expand All @@ -222,7 +222,7 @@ if(BUILD_TESTING)
# rclcpp::rclcpp
)

ament_add_gtest(${PROJECT_NAME}_test_velocity test/velocity_test.cpp)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test_velocity test/velocity_test.cpp)
target_link_libraries(${PROJECT_NAME}_test_velocity
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
Expand All @@ -231,7 +231,7 @@ if(BUILD_TESTING)
# rclcpp::rclcpp
)

ament_add_gtest(${PROJECT_NAME}_test_listener test/listener_unittest.cpp)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test_listener test/listener_unittest.cpp)
target_link_libraries(${PROJECT_NAME}_test_listener
ament_cmake_ros_core::ament_ros_defaults
${PROJECT_NAME}
Expand Down
2 changes: 1 addition & 1 deletion tf2_ros/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<depend>tf2</depend>
<depend>tf2_msgs</depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>rosgraph_msgs</test_depend>
Expand Down
25 changes: 25 additions & 0 deletions tf2_ros_py/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2026 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest
from rmw_test_fixture_implementation import rmw_test_isolation_start
from rmw_test_fixture_implementation import rmw_test_isolation_stop


@pytest.fixture(autouse=True, scope='session')
def rmw_isolation():
"""Start RMW isolation before any ROS context is created."""
rmw_test_isolation_start()
yield
rmw_test_isolation_stop()
1 change: 1 addition & 0 deletions tf2_ros_py/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<test_depend>ament_pep257</test_depend>
<test_depend>ament_xmllint</test_depend>
<test_depend>python3-pytest</test_depend>
<test_depend>rmw_test_fixture_implementation</test_depend>

<export>
<build_type>ament_python</build_type>
Expand Down