From 2dff201402d40261b62e5ac9914de5dea1a0c361 Mon Sep 17 00:00:00 2001 From: Fabio Rossetto Date: Fri, 22 Nov 2024 15:45:06 +0100 Subject: [PATCH] Set allow_version_mismatch to False by default (L1-2561) --- src/zhinst/toolkit/session.py | 9 +++++---- tests/test_data_server_session.py | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/zhinst/toolkit/session.py b/src/zhinst/toolkit/session.py index 36be8f50..781636ad 100644 --- a/src/zhinst/toolkit/session.py +++ b/src/zhinst/toolkit/session.py @@ -655,9 +655,10 @@ class Session(Node): connection: Existing DAQ server object. If specified the session will not create a new session to the data server but reuse the passed one. (default = None) - allow_version_mismatch: When set to False, an exception will be raised - when attempting to connect to a data-server on a different version - than that of the zhinst.core library. (default = True) + allow_version_mismatch: if set to True, the connection to the data-server + will succeed even if the data-server is on a different version of LabOne. + If False, an exception will be raised if the data-server is on a + different version. (default = False) .. versionchanged:: 0.7.1 Added `allow_version_mismatch` argument. @@ -670,7 +671,7 @@ def __init__( *, hf2: t.Optional[bool] = None, connection: t.Optional[core.ziDAQServer] = None, - allow_version_mismatch: bool = True, + allow_version_mismatch: bool = False, ): self._is_hf2_server = bool(hf2) if connection is not None: diff --git a/tests/test_data_server_session.py b/tests/test_data_server_session.py index 4095c443..f5a2a23c 100644 --- a/tests/test_data_server_session.py +++ b/tests/test_data_server_session.py @@ -10,7 +10,7 @@ def test_setup(mock_connection, session): mock_connection.assert_called_once_with( - "localhost", 8004, 6, allow_version_mismatch=True + "localhost", 8004, 6, allow_version_mismatch=False ) mock_connection.return_value.listNodesJSON.assert_called_once_with("/zi/*") assert repr(session) == "DataServerSession(localhost:8004)" @@ -21,7 +21,7 @@ def test_setup(mock_connection, session): def test_setup_hf2(mock_connection, hf2_session): mock_connection.assert_called_once_with( - "localhost", 8005, 1, allow_version_mismatch=True + "localhost", 8005, 1, allow_version_mismatch=False ) mock_connection.return_value.listNodesJSON.assert_not_called() assert repr(hf2_session) == "HF2DataServerSession(localhost:8005)" @@ -39,7 +39,7 @@ def create_daq(*args, **kwargs): mock_connection.side_effect = create_daq Session("localhost", 8004) - mock_connection.assert_any_call("localhost", 8004, 6, allow_version_mismatch=True) + mock_connection.assert_any_call("localhost", 8004, 6, allow_version_mismatch=False) mock_connection.assert_called_with("localhost", 8004, 6) @@ -70,7 +70,7 @@ def create_daq(*args, **kwargs): mock_connection.side_effect = create_daq Session("localhost", 8004) mock_connection.assert_called_once_with( - "localhost", 8004, 6, allow_version_mismatch=True + "localhost", 8004, 6, allow_version_mismatch=False )