Skip to content

Commit 09dabbf

Browse files
committed
wincheck
1 parent 1b83584 commit 09dabbf

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tests/unit/test_logging.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@
6969
)
7070

7171

72-
def _get_windows_sleep_time() -> float:
73-
"""Get adjusted sleep time for Windows systems."""
74-
return 10.0 if sys.platform == 'win32' else 2.0
75-
76-
7772
class StatusResponseGenerator:
7873
"""Generator for actor run status responses to simulate changing status over time."""
7974

@@ -123,7 +118,7 @@ def _streaming_log_handler(_request: Request) -> Response:
123118
def generate_logs() -> Iterator[bytes]:
124119
for chunk in _MOCKED_ACTOR_LOGS:
125120
yield chunk
126-
time.sleep(0.05)
121+
time.sleep(0.01)
127122

128123
total_size = sum(len(chunk) for chunk in _MOCKED_ACTOR_LOGS)
129124

@@ -211,7 +206,7 @@ async def test_redirected_logs_async(
211206
with caplog.at_level(logging.DEBUG, logger=logger_name):
212207
async with streamed_log:
213208
# Do stuff while the log from the other Actor is being redirected to the logs.
214-
await asyncio.sleep(2)
209+
await asyncio.sleep(4.0 if sys.platform == 'win32' else 2.0)
215210

216211
# Ensure logs are propagated
217212
assert {(record.message, record.levelno) for record in caplog.records} == set(
@@ -250,7 +245,7 @@ def test_redirected_logs_sync(
250245

251246
with caplog.at_level(logging.DEBUG, logger=logger_name), streamed_log:
252247
# Do stuff while the log from the other Actor is being redirected to the logs.
253-
time.sleep(_get_windows_sleep_time())
248+
time.sleep(4.0 if sys.platform == 'win32' else 2.0)
254249

255250
# Ensure logs are propagated
256251
assert {(record.message, record.levelno) for record in caplog.records} == set(
@@ -427,7 +422,7 @@ def test_redirect_status_message_sync(
427422
status_message_redirector = run_client.get_status_message_watcher(check_period=timedelta(seconds=0))
428423
with caplog.at_level(logging.DEBUG, logger=logger_name), status_message_redirector:
429424
# Do stuff while the status from the other Actor is being redirected to the logs.
430-
time.sleep(_get_windows_sleep_time())
425+
time.sleep(3)
431426

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

0 commit comments

Comments
 (0)