Skip to content

Commit e06f2c2

Browse files
committed
wincheck
1 parent 919d39e commit e06f2c2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/unit/test_logging.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import asyncio
44
import json
55
import logging
6+
import sys
67
import time
78
from datetime import datetime, timedelta
89
from typing import TYPE_CHECKING
@@ -68,6 +69,11 @@
6869
)
6970

7071

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+
7177
class StatusResponseGenerator:
7278
"""Generator for actor run status responses to simulate changing status over time."""
7379

@@ -244,7 +250,7 @@ def test_redirected_logs_sync(
244250

245251
with caplog.at_level(logging.DEBUG, logger=logger_name), streamed_log:
246252
# 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())
248254

249255
# Ensure logs are propagated
250256
assert {(record.message, record.levelno) for record in caplog.records} == set(
@@ -421,7 +427,7 @@ def test_redirect_status_message_sync(
421427
status_message_redirector = run_client.get_status_message_watcher(check_period=timedelta(seconds=0))
422428
with caplog.at_level(logging.DEBUG, logger=logger_name), status_message_redirector:
423429
# 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())
425431

426432
assert caplog.records[0].message == 'Status: RUNNING, Message: Initial message'
427433
assert caplog.records[1].message == 'Status: RUNNING, Message: Another message'

0 commit comments

Comments
 (0)