Skip to content

Commit d691b29

Browse files
committed
fix: Suppress RuntimeError during rclpy spin in service capabilities tests
1 parent a30fbe2 commit d691b29

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rosbridge_library/test/capabilities/test_service_capabilities.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
from __future__ import annotations
33

4+
import contextlib
45
import time
56
import unittest
67
from json import dumps, loads
@@ -271,7 +272,9 @@ def test_unadvertise_with_live_request(self) -> None:
271272
self.received_message = None
272273
start_time = time.monotonic()
273274
while self.received_message is None:
274-
rclpy.spin_once(self.node, timeout_sec=0.1)
275+
# TODO: Remove this suppress once this is merged: https://github.com/ros2/rclpy/pull/1582
276+
with contextlib.suppress(RuntimeError):
277+
rclpy.spin_once(self.node, timeout_sec=0.1)
275278
if time.monotonic() - start_time > 1.0:
276279
self.fail(
277280
"Timed out waiting for service_response after unadvertise (expected timeout response)."

0 commit comments

Comments
 (0)