add integration test for CameraDetectionNode #393
build_and_unitest.yml
on: pull_request
Setup environment
23s
Matrix: Build Image and Run Unit Testing Suite
Confirm Build and Unit Tests Completed
0s
Annotations
5 errors and 3 notices
src/perception/camera_object_detection/test/camera_object_detection_test.py#L9
import pytest
from sensor_msgs.msg import Image
from camera_object_detection.yolov8_detection import CameraDetectionNode
+
@pytest.mark.launch_test
def generate_test_description():
|
src/perception/camera_object_detection/test/camera_object_detection_test.py#L32
@classmethod
def setUpClass(cls):
rclpy.init()
- cls.node = CameraDetectionNode() # create a CameraDetectionNode to test
+ cls.node = CameraDetectionNode() # create a CameraDetectionNode to test
cls.logs_received = []
cls.images_received = []
|
src/perception/camera_object_detection/test/camera_object_detection_test.py#L78
# Test the image_callback function of the CameraDetectionNode node
self.node.image_callback(dummy_image)
-
+
# Spin some time to collect logs
end_time = self.node.get_clock().now() + rclpy.time.Duration(seconds=10)
while rclpy.ok() and self.node.get_clock().now() < end_time:
rclpy.spin_once(self.node, timeout_sec=0.1)
# Check if the expected log messages were received
- expected_log_messages = ["Successfully created node listening on camera topic:", "Finished in:"] # From CameraDetectionNode logger
+ # From CameraDetectionNode logger
+ expected_log_messages = [
+ "Successfully created node listening on camera topic:", "Finished in:"]
for expected_msg in expected_log_messages:
message_logged = any(
expected_msg in log.msg and log.name == "camera_object_detection_node"
for log in self.logs_received
)
- self.assertTrue(message_logged, f"Expected log message '{expected_msg}' not found in the logs.")
+ self.assertTrue(
+ message_logged, f"Expected log message '{expected_msg}' not found in the logs.")
- self.assertTrue(len(self.images_received) > 0, "No visualization images were published.") # Check that given an image, the node is publishing
+ # Check that given an image, the node is publishing
+ self.assertTrue(len(self.images_received) > 0, "No visualization images were published.")
+
if __name__ == '__main__':
unittest.main()
|
src/perception/camera_object_detection/launch/camera_object_detection_test.launch.py#L36
ld.add_action(camera_object_detection_node)
- return ld
\ No newline at end of file
+ return ld
|
Build Image and Run Unit Testing Suite (perception, camera_object_detection)
Process completed with exit code 1.
|
Setup environment
Detected infrastructure changes
|
Setup environment
Using camera-detection-node-test as the source branch
|
Setup environment
Using main as the target branch
|