Skip to content

Fix Windows failures in test_sleep_multiple_concurrent_waiters#1660

Open
nadavelkabets wants to merge 1 commit into
ros2:rollingfrom
nadavelkabets:bugfix/test-async-clock-windows
Open

Fix Windows failures in test_sleep_multiple_concurrent_waiters#1660
nadavelkabets wants to merge 1 commit into
ros2:rollingfrom
nadavelkabets:bugfix/test-async-clock-windows

Conversation

@nadavelkabets
Copy link
Copy Markdown
Contributor

Summary

Fixes test from #1620
Asyncio's clock (monotonic) has 15ms accuracy on windows, causing this test to fail.
The failure is due to asyncio's behavior of waking timer calls one clock tick early, failing the assert in the test.

Test failure

https://ci.ros2.org/view/nightly/job/nightly_win_rel/lastCompletedBuild/testReport/rclpy.rclpy.test/test_async_clock/test_sleep_multiple_concurrent_waiters/

+ Exception Group Traceback (most recent call last):
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\_pytest\runner.py", line 341, in from_call
  |     result: Optional[TResult] = func()
  |                                 ^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\_pytest\runner.py", line 262, in <lambda>
  |     lambda: ihook(item=item, **kwds), when=when, reraise=reraise
  |             ^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_hooks.py", line 501, in __call__
  |     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_manager.py", line 119, in _hookexec
  |     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_callers.py", line 181, in _multicall
  |     return outcome.get_result()
  |            ^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_result.py", line 99, in get_result
  |     raise exc.with_traceback(exc.__traceback__)
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_callers.py", line 102, in _multicall
  |     res = hook_impl.function(*args)
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\_pytest\runner.py", line 177, in pytest_runtest_call
  |     raise e
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\_pytest\runner.py", line 169, in pytest_runtest_call
  |     item.runtest()
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\_pytest\python.py", line 1792, in runtest
  |     self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_hooks.py", line 501, in __call__
  |     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_manager.py", line 119, in _hookexec
  |     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_callers.py", line 181, in _multicall
  |     return outcome.get_result()
  |            ^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_result.py", line 99, in get_result
  |     raise exc.with_traceback(exc.__traceback__)
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pluggy\_callers.py", line 102, in _multicall
  |     res = hook_impl.function(*args)
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\_pytest\python.py", line 194, in pytest_pyfunc_call
  |     result = testfunction(**testargs)
  |              ^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\site-packages\pytest_asyncio\plugin.py", line 478, in inner
  |     _loop.run_until_complete(task)
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\asyncio\base_events.py", line 687, in run_until_complete
  |     return future.result()
  |            ^^^^^^^^^^^^^^^
  |   File "C:\ci\ws\src\ros2\rclpy\rclpy\test\test_async_clock.py", line 115, in test_sleep_multiple_concurrent_waiters
  |     async with AsyncNode('test_multi_sleep_node') as node:
  |   File "C:\ci\ws\src\ros2\rclpy\rclpy\rclpy\experimental\async_node.py", line 152, in __aexit__
  |     await self._tg.__aexit__(exc_type, exc_val, exc_tb)
  |   File "C:\pixi_ws\.pixi\envs\default\Lib\asyncio\taskgroups.py", line 145, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "C:\ci\ws\src\ros2\rclpy\rclpy\test\test_async_clock.py", line 132, in test_sleep_multiple_concurrent_waiters
    |     assert t_mid.result() >= 0.1
    | AssertionError: assert 0.0940000000409782 >= 0.1
    |  +  where 0.0940000000409782 = <built-in method result of _asyncio.Task object at 0x000001E095B413C0>()
    |  +    where <built-in method result of _asyncio.Task object at 0x000001E095B413C0> = <Task finished name='Task-55' coro=<test_sleep_multiple_concurrent_waiters.<locals>.timed() done, defined at C:\ci\ws\src\ros2\rclpy\rclpy\test\test_async_clock.py:120> result=0.0940000000409782>.result
    +------------------------------------

@nadavelkabets nadavelkabets changed the title Fix async clock test that fails due to windows clock resolution Fix Windows failures in test_sleep_multiple_concurrent_waiters May 3, 2026
Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with green CI.

@fujitatomoya
Copy link
Copy Markdown
Collaborator

@Mergifyio rebase

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 14, 2026

Deprecation notice: This pull request comes from a fork and was rebased using bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the rebase action will no longer be able to rebase fork pull requests with this configuration. Please switch to the update action/command to ensure compatibility going forward.

@fujitatomoya fujitatomoya force-pushed the bugfix/test-async-clock-windows branch from 8d2c20d to 87b96a7 Compare May 14, 2026 04:21
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 14, 2026

rebase

✅ Branch has been successfully rebased

@fujitatomoya
Copy link
Copy Markdown
Collaborator

Pulls: #1660
Gist: https://gist.githubusercontent.com/fujitatomoya/f2452d8327489c900a46abab532a6a41/raw/a16854434433a544ef9d616e2f2b578b3e63f564/ros2.repos
BUILD args: --packages-above-and-dependencies rclpy
TEST args: --packages-above rclpy
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19261

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@fujitatomoya
Copy link
Copy Markdown
Collaborator

@Mergifyio rebase

…windows

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 16, 2026

rebase

✅ Branch has been successfully rebased

@fujitatomoya fujitatomoya force-pushed the bugfix/test-async-clock-windows branch from 87b96a7 to 7bc1b1a Compare May 16, 2026 00:35
@fujitatomoya
Copy link
Copy Markdown
Collaborator

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants