Skip to content

Commit b316248

Browse files
committed
Update test_logger.py
1 parent 275ab32 commit b316248

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_serverless/test_modules/test_logger.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ def test_log_tip(self):
111111

112112
def test_log_job_id(self):
113113
""" Tests that the log method logs a job id """
114-
with patch("runpod.serverless.modules.rp_logger.RunPodLogger.log") as mock_log:
115-
self.logger.log("test_message", "INFO", "test_job_id")
116-
mock_log.assert_called_once_with("test_message", "INFO", "test_job_id")
114+
logger = rp_logger.RunPodLogger()
115+
job_id = "test_job_id"
116+
117+
# Patch print to capture stdout
118+
with patch("builtins.print") as mock_print:
119+
logger.log("test_message", "INFO", job_id)
120+
mock_print.assert_called_once_with(
121+
'{"requestId": "test_job_id", "message": "test_message", "level": "INFO"}',
122+
flush=True
123+
)

0 commit comments

Comments
 (0)