-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wait_for_future for cancelled futures
Signed-off-by: Michel Hidalgo <mhidalgo@theaiinstitute.com>
1 parent
25ba838
commit 4e3d00d
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2024 Boston Dynamics AI Institute Inc. All rights reserved. | ||
|
||
from rclpy.task import Future | ||
|
||
from bdai_ros2_wrappers.futures import wait_for_future | ||
from bdai_ros2_wrappers.scope import ROSAwareScope | ||
|
||
|
||
def test_wait_for_cancelled_future(ros: ROSAwareScope) -> None: | ||
"""Asserts that waiting for a cancelled future does not hang indefinitely.""" | ||
future = Future() | ||
future.cancel() | ||
|
||
assert not wait_for_future(future, context=ros.context) | ||
assert future.cancelled() |