[BUGFIX] Fix flakey unit test

This commit is contained in:
Jesse Bannon 2023-03-10 13:06:55 -08:00
parent 0cd8df6e11
commit 8b4e7a52be
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: