From 9cd947399b96d77ae9b8093d48881e4a05ca79ea Mon Sep 17 00:00:00 2001 From: Dan Halperin Date: Mon, 8 Jul 2024 12:28:51 -0700 Subject: [PATCH] test_workhelper: force default loglevel for caplog (#915) commit-id:c6bd5449 --- tests/client/test_workhelper.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/client/test_workhelper.py b/tests/client/test_workhelper.py index f44a3698..8ef26a79 100644 --- a/tests/client/test_workhelper.py +++ b/tests/client/test_workhelper.py @@ -14,6 +14,7 @@ import datetime import json +import logging from unittest.mock import patch import pytest @@ -138,7 +139,8 @@ def test_print_workstatus_fresh_task(caplog): ], } ) - _print_work_status_helper(session, workStatus, taskDetails, nowFunction) + with caplog.at_level(logging.DEBUG): + _print_work_status_helper(session, workStatus, taskDetails, nowFunction) assert "status: TEST" in caplog.text assert ( ".... {obtained} Fooing the bar".format( @@ -170,7 +172,8 @@ def test_print_workstatus_fresh_task_subtasks(caplog): ], } ) - _print_work_status_helper(session, workStatus, taskDetails, nowFunction) + with caplog.at_level(logging.DEBUG): + _print_work_status_helper(session, workStatus, taskDetails, nowFunction) assert "status: TEST" in caplog.text assert ( ".... {obtained} Fooing the bar 1 / 2.".format( @@ -202,7 +205,8 @@ def test_print_workstatus_old_task(caplog): ], } ) - _print_work_status_helper(session, workStatus, taskDetails, nowFunction) + with caplog.at_level(logging.DEBUG): + _print_work_status_helper(session, workStatus, taskDetails, nowFunction) assert "status: TEST" in caplog.text assert ( ".... {obtained} Fooing the bar. (1y27d13:16:39 elapsed)".format( @@ -234,7 +238,8 @@ def test_print_workstatus_old_task_subtasks(caplog): ], } ) - _print_work_status_helper(session, workStatus, taskDetails, nowFunction) + with caplog.at_level(logging.DEBUG): + _print_work_status_helper(session, workStatus, taskDetails, nowFunction) assert "status: TEST" in caplog.text assert ( ".... {obtained} Fooing the bar 1 / 2. (1y27d13:16:39 elapsed)".format(