Skip to content

Commit 55ec626

Browse files
committed
Update test_logger.py
1 parent 98baddc commit 55ec626

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_serverless/test_modules/test_logger.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
''' Tests for runpod.serverless.modules.rp_logger '''
22

3+
import os
34
import unittest
45
from unittest.mock import patch
56

@@ -117,7 +118,18 @@ def test_log_job_id(self):
117118
# Patch print to capture stdout
118119
with patch("builtins.print") as mock_print:
119120
logger.log("test_message", "INFO", job_id)
121+
122+
mock_print.assert_called_once_with(
123+
"'INFO | test_job_id | test_message', flush=True",
124+
flush=True
125+
)
126+
127+
os.environ["RUNPOD_ENDPOINT_ID"] = "test_endpoint_id"
128+
logger.log("test_message", "INFO", job_id)
129+
120130
mock_print.assert_called_once_with(
121131
'{"requestId": "test_job_id", "message": "test_message", "level": "INFO"}',
122132
flush=True
123133
)
134+
135+
os.environ.pop("RUNPOD_ENDPOINT_ID")

0 commit comments

Comments
 (0)