We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3621165 commit fbd9252Copy full SHA for fbd9252
platform/mellanox/mlnx-platform-api/tests/test_dpuctlplat.py
@@ -66,9 +66,12 @@ def test_setup_logger(self, dpuctl_obj):
66
"""Test logger setup"""
67
# Test with print mode
68
dpuctl_obj.setup_logger(True)
69
- assert dpuctl_obj.logger_info == print
70
- assert dpuctl_obj.logger_error == print
71
- assert dpuctl_obj.logger_debug == print
+ # Test that the logger functions add timestamps
+ with patch('time.strftime') as mock_time:
+ mock_time.return_value = "2024-01-01 12:00:00"
72
+ with patch('builtins.print') as mock_print:
73
+ dpuctl_obj.logger_info("test message")
74
+ mock_print.assert_called_once_with("[2024-01-01 12:00:00] test message")
75
76
# Test with syslogger mode
77
dpuctl_obj.setup_logger(False)
0 commit comments