|
69 | 69 | ) |
70 | 70 |
|
71 | 71 |
|
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 | | - |
77 | 72 | class StatusResponseGenerator: |
78 | 73 | """Generator for actor run status responses to simulate changing status over time.""" |
79 | 74 |
|
@@ -123,7 +118,7 @@ def _streaming_log_handler(_request: Request) -> Response: |
123 | 118 | def generate_logs() -> Iterator[bytes]: |
124 | 119 | for chunk in _MOCKED_ACTOR_LOGS: |
125 | 120 | yield chunk |
126 | | - time.sleep(0.05) |
| 121 | + time.sleep(0.01) |
127 | 122 |
|
128 | 123 | total_size = sum(len(chunk) for chunk in _MOCKED_ACTOR_LOGS) |
129 | 124 |
|
@@ -211,7 +206,7 @@ async def test_redirected_logs_async( |
211 | 206 | with caplog.at_level(logging.DEBUG, logger=logger_name): |
212 | 207 | async with streamed_log: |
213 | 208 | # 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) |
215 | 210 |
|
216 | 211 | # Ensure logs are propagated |
217 | 212 | assert {(record.message, record.levelno) for record in caplog.records} == set( |
@@ -250,7 +245,7 @@ def test_redirected_logs_sync( |
250 | 245 |
|
251 | 246 | with caplog.at_level(logging.DEBUG, logger=logger_name), streamed_log: |
252 | 247 | # 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) |
254 | 249 |
|
255 | 250 | # Ensure logs are propagated |
256 | 251 | assert {(record.message, record.levelno) for record in caplog.records} == set( |
@@ -427,7 +422,7 @@ def test_redirect_status_message_sync( |
427 | 422 | status_message_redirector = run_client.get_status_message_watcher(check_period=timedelta(seconds=0)) |
428 | 423 | with caplog.at_level(logging.DEBUG, logger=logger_name), status_message_redirector: |
429 | 424 | # 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) |
431 | 426 |
|
432 | 427 | assert caplog.records[0].message == 'Status: RUNNING, Message: Initial message' |
433 | 428 | assert caplog.records[1].message == 'Status: RUNNING, Message: Another message' |
|
0 commit comments