|
3 | 3 | import asyncio |
4 | 4 | import json |
5 | 5 | import logging |
| 6 | +import sys |
6 | 7 | import time |
7 | 8 | from datetime import datetime, timedelta |
8 | 9 | from typing import TYPE_CHECKING |
|
68 | 69 | ) |
69 | 70 |
|
70 | 71 |
|
| 72 | +def _get_windows_sleep_time() -> float: |
| 73 | + """Get adjusted sleep time for Windows systems.""" |
| 74 | + return 5.0 if sys.platform == 'win32' else 2.0 |
| 75 | + |
| 76 | + |
71 | 77 | class StatusResponseGenerator: |
72 | 78 | """Generator for actor run status responses to simulate changing status over time.""" |
73 | 79 |
|
@@ -244,7 +250,7 @@ def test_redirected_logs_sync( |
244 | 250 |
|
245 | 251 | with caplog.at_level(logging.DEBUG, logger=logger_name), streamed_log: |
246 | 252 | # Do stuff while the log from the other Actor is being redirected to the logs. |
247 | | - time.sleep(2) |
| 253 | + time.sleep(_get_windows_sleep_time()) |
248 | 254 |
|
249 | 255 | # Ensure logs are propagated |
250 | 256 | assert {(record.message, record.levelno) for record in caplog.records} == set( |
@@ -421,7 +427,7 @@ def test_redirect_status_message_sync( |
421 | 427 | status_message_redirector = run_client.get_status_message_watcher(check_period=timedelta(seconds=0)) |
422 | 428 | with caplog.at_level(logging.DEBUG, logger=logger_name), status_message_redirector: |
423 | 429 | # Do stuff while the status from the other Actor is being redirected to the logs. |
424 | | - time.sleep(3) |
| 430 | + time.sleep(_get_windows_sleep_time()) |
425 | 431 |
|
426 | 432 | assert caplog.records[0].message == 'Status: RUNNING, Message: Initial message' |
427 | 433 | assert caplog.records[1].message == 'Status: RUNNING, Message: Another message' |
|
0 commit comments