[BUGFIX] Fix flakey unit test (#529)

This commit is contained in:
Jesse Bannon 2023-03-10 13:21:27 -08:00 committed by GitHub
parent 0cd8df6e11
commit 54697f6ddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -28,8 +28,10 @@ def cleanup_debug_file():
Clean logs after every test
"""
Logger.set_log_level(log_level_name=LoggerLevels.DEBUG.name)
yield
Logger.cleanup()
try:
yield
finally:
Logger.cleanup()
@pytest.fixture

View file

@ -1,4 +1,5 @@
import os.path
import time
import pytest
@ -148,6 +149,9 @@ class TestLogger:
print("test line 1")
print("test line 2")
# Wait for flushed logs
time.sleep(0.1)
# Ensure it goes to stdout only if it is expected to
captured = capsys.readouterr()
if expected_stdout: