diff --git a/rclpy/test/test_client.py b/rclpy/test/test_client.py index e9ea9e312..207dc0aac 100644 --- a/rclpy/test/test_client.py +++ b/rclpy/test/test_client.py @@ -213,6 +213,8 @@ def _service(request, response): executor_thread = threading.Thread( target=TestClient._spin_rclpy_node, args=(self.node, executor)) executor_thread.start() + # make sure thread has started to avoid exception via join() + self.assertTrue(executor_thread.is_alive()) result = cli.call(GetParameters.Request(), 0.5) self.assertTrue(result is not None) executor.shutdown() @@ -234,6 +236,8 @@ def _service(request, response): executor_thread = threading.Thread( target=TestClient._spin_rclpy_node, args=(self.node, executor)) executor_thread.start() + # make sure thread has started to avoid exception via join() + self.assertTrue(executor_thread.is_alive()) with self.assertRaises(TimeoutError): cli.call(GetParameters.Request(), 0.5) finally: @@ -253,6 +257,8 @@ def _service(request, response): executor_thread = threading.Thread( target=TestClient._spin_rclpy_node, args=(self.node, executor)) executor_thread.start() + # make sure thread has started to avoid exception via join() + self.assertTrue(executor_thread.is_alive()) result = cli.call(GetParameters.Request(), 0.5) self.assertTrue(result is not None) executor.shutdown()