mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-06-06 13:28:41 +02:00
fix(logging): removed args/kwargs from logging messages
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
# pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
|
||||
import threading
|
||||
import time
|
||||
from types import SimpleNamespace
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
from bec_lib import service_config
|
||||
from bec_lib.messages import ScanMessage
|
||||
from bec_lib.messages import GUIInstructionMessage, ScanMessage
|
||||
from bec_lib.serialization import MsgpackSerialization
|
||||
|
||||
from bec_widgets.utils.bec_dispatcher import BECDispatcher, QtRedisConnector, QtThreadSafeCallback
|
||||
@@ -227,11 +226,9 @@ def test_qt_redis_connector_logs_rpc_before_qt_callback(monkeypatch):
|
||||
|
||||
cb = QtThreadSafeCallback(callback)
|
||||
connector = QtRedisConnector("localhost:1", mock.MagicMock())
|
||||
rpc_msg = SimpleNamespace(
|
||||
content={
|
||||
"action": "set_value",
|
||||
"parameter": {"args": [1], "kwargs": {"source": "test"}, "gui_id": "ring"},
|
||||
},
|
||||
rpc_msg = GUIInstructionMessage(
|
||||
action="set_value",
|
||||
parameter={"args": [1], "kwargs": {"source": "test"}, "gui_id": "ring"},
|
||||
metadata={
|
||||
"request_id": "dispatcher-request",
|
||||
"receiver": "gui",
|
||||
@@ -255,14 +252,10 @@ def test_qt_redis_connector_logs_rpc_before_qt_callback(monkeypatch):
|
||||
assert "object_name=progressbar" in info_message
|
||||
assert "timeout=0.1" in info_message
|
||||
assert "stale_on_dispatch=True" in info_message
|
||||
assert "args=[1]" in info_message
|
||||
assert "kwargs={'source': 'test'}" in info_message
|
||||
|
||||
warning_mock.assert_called_once()
|
||||
warning_message = warning_mock.call_args.args[0]
|
||||
assert "received request after client timeout deadline" in warning_message
|
||||
assert "request_id=dispatcher-request" in warning_message
|
||||
assert "args=[1]" in warning_message
|
||||
assert "kwargs={'source': 'test'}" in warning_message
|
||||
finally:
|
||||
connector.shutdown()
|
||||
|
||||
@@ -76,8 +76,6 @@ def test_run_rpc_logs_response_timeout(monkeypatch):
|
||||
assert publish_msg.metadata["deadline"] == publish_msg.metadata["sent_at"]
|
||||
assert info_mock.call_count == 1
|
||||
info_message = info_mock.call_args.args[0]
|
||||
assert "args=(42,)" in info_message
|
||||
assert "kwargs={'precision': 2}" in info_message
|
||||
error_mock.assert_called_once()
|
||||
error_message = error_mock.call_args.args[0]
|
||||
assert "GUI RPC response timeout" in error_message
|
||||
@@ -85,5 +83,3 @@ def test_run_rpc_logs_response_timeout(monkeypatch):
|
||||
assert "target_gui_id=progress_widget" in error_message
|
||||
assert "object_name=progressbar" in error_message
|
||||
assert "timeout=0" in error_message
|
||||
assert "args=(42,)" in error_message
|
||||
assert "kwargs={'precision': 2}" in error_message
|
||||
|
||||
@@ -198,15 +198,9 @@ def test_on_rpc_update_logs_late_client_deadline(rpc_server, monkeypatch):
|
||||
assert "target_gui_id=ring" in received_log
|
||||
assert "timeout=0.1" in received_log
|
||||
assert "stale_on_receive=True" in received_log
|
||||
assert "args=[1]" in received_log
|
||||
assert "kwargs={'source': 'test'}" in received_log
|
||||
assert "response_after_client_deadline=True" in executed_log
|
||||
assert "args=[1]" in executed_log
|
||||
assert "kwargs={'source': 'test'}" in executed_log
|
||||
assert "received request after client timeout deadline" in warning_logs
|
||||
assert "response is late for client timeout" in warning_logs
|
||||
assert "args=[1]" in warning_logs
|
||||
assert "kwargs={'source': 'test'}" in warning_logs
|
||||
|
||||
|
||||
def test_run_rpc_delegates_to_rpc_content_class(rpc_server):
|
||||
|
||||
Reference in New Issue
Block a user