3
3
import asyncio
4
4
import json
5
5
import logging
6
- import sys
7
6
import time
8
7
from datetime import datetime , timedelta
9
8
from typing import TYPE_CHECKING
@@ -133,8 +132,6 @@ def generate_logs() -> Iterator[bytes]:
133
132
@pytest .fixture
134
133
def mock_api (httpserver : HTTPServer ) -> None :
135
134
"""Set up HTTP server with mocked API endpoints."""
136
- httpserver .clear () # type: ignore[no-untyped-call]
137
-
138
135
status_generator = StatusResponseGenerator ()
139
136
140
137
# Add actor run status endpoint
@@ -206,7 +203,7 @@ async def test_redirected_logs_async(
206
203
with caplog .at_level (logging .DEBUG , logger = logger_name ):
207
204
async with streamed_log :
208
205
# Do stuff while the log from the other Actor is being redirected to the logs.
209
- await asyncio .sleep (4.0 if sys . platform == 'win32' else 2.0 )
206
+ await asyncio .sleep (1 )
210
207
211
208
# Ensure logs are propagated
212
209
assert {(record .message , record .levelno ) for record in caplog .records } == set (
@@ -245,7 +242,7 @@ def test_redirected_logs_sync(
245
242
246
243
with caplog .at_level (logging .DEBUG , logger = logger_name ), streamed_log :
247
244
# Do stuff while the log from the other Actor is being redirected to the logs.
248
- time .sleep (4.0 if sys . platform == 'win32' else 2.0 )
245
+ time .sleep (1 )
249
246
250
247
# Ensure logs are propagated
251
248
assert {(record .message , record .levelno ) for record in caplog .records } == set (
@@ -398,7 +395,7 @@ async def test_redirect_status_message_async(
398
395
with caplog .at_level (logging .DEBUG , logger = logger_name ):
399
396
async with status_message_redirector :
400
397
# Do stuff while the status from the other Actor is being redirected to the logs.
401
- await asyncio .sleep (3 )
398
+ await asyncio .sleep (1 )
402
399
403
400
assert caplog .records [0 ].message == 'Status: RUNNING, Message: Initial message'
404
401
assert caplog .records [1 ].message == 'Status: RUNNING, Message: Another message'
@@ -422,7 +419,7 @@ def test_redirect_status_message_sync(
422
419
status_message_redirector = run_client .get_status_message_watcher (check_period = timedelta (seconds = 0 ))
423
420
with caplog .at_level (logging .DEBUG , logger = logger_name ), status_message_redirector :
424
421
# Do stuff while the status from the other Actor is being redirected to the logs.
425
- time .sleep (3 )
422
+ time .sleep (1 )
426
423
427
424
assert caplog .records [0 ].message == 'Status: RUNNING, Message: Initial message'
428
425
assert caplog .records [1 ].message == 'Status: RUNNING, Message: Another message'
0 commit comments