@@ -422,7 +422,8 @@ def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2):
422
422
time .sleep (0.05 )
423
423
self ._raise_assertion_error ('Expected messages "{}" does not partially match log:\n \n {}\n \n ' .format (str (expected_msgs ), print_log ))
424
424
425
- def wait_for_debug_log (self , expected_msgs , timeout = 10 , ignore_case = False ) -> int :
425
+ @contextlib .contextmanager
426
+ def wait_for_debug_log (self , expected_msgs , timeout = 60 , ignore_case = False ):
426
427
"""
427
428
Block until we see a particular debug log message fragment or until we exceed the timeout.
428
429
Return:
@@ -432,6 +433,8 @@ def wait_for_debug_log(self, expected_msgs, timeout=10, ignore_case=False) -> in
432
433
prev_size = self .debug_log_bytes ()
433
434
re_flags = re .MULTILINE | (re .IGNORECASE if ignore_case else 0 )
434
435
436
+ yield
437
+
435
438
while True :
436
439
found = True
437
440
with open (self .debug_log_path , encoding = 'utf-8' ) as dl :
@@ -443,8 +446,7 @@ def wait_for_debug_log(self, expected_msgs, timeout=10, ignore_case=False) -> in
443
446
found = False
444
447
445
448
if found :
446
- num_logs = len (log .splitlines ())
447
- return num_logs
449
+ return
448
450
449
451
if time .time () >= time_end :
450
452
print_log = " - " + "\n - " .join (log .splitlines ())
@@ -456,7 +458,6 @@ def wait_for_debug_log(self, expected_msgs, timeout=10, ignore_case=False) -> in
456
458
self ._raise_assertion_error (
457
459
'Expected messages "{}" does not partially match log:\n \n {}\n \n ' .format (
458
460
str (expected_msgs ), print_log ))
459
- return - 1 # useless return to satisfy linter
460
461
461
462
@contextlib .contextmanager
462
463
def profile_with_perf (self , profile_name : str ):
0 commit comments