Skip to content

Commit

Permalink
Set allow_version_mismatch to False by default (L1-2561)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio Rossetto committed Nov 25, 2024
1 parent 7e2b778 commit 2dff201
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/zhinst/toolkit/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_data_server_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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)"
Expand All @@ -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)


Expand Down Expand Up @@ -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
)


Expand Down

0 comments on commit 2dff201

Please sign in to comment.