Skip to content

Commit

Permalink
Added BaseInstrument.session property
Browse files Browse the repository at this point in the history
  • Loading branch information
markheik committed Dec 19, 2022
1 parent 2a1bbe3 commit 6267dd6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Added full support for the following LabOne modules (no need to fallback to zhinst.core):
* Impedance Module
* Precompensation Advisor Module
* Added `session` property to `BaseInstrument`. This enables getting the given `Session` from the instrument.
* Fix issue with downloading waveforms from the device. This issue prevented indexes larger than 9 to be read from the device.

## Version 0.5.0
Expand Down
8 changes: 8 additions & 0 deletions src/zhinst/toolkit/driver/devices/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,14 @@ def serial(self) -> str:
"""Instrument specific serial."""
return self._serial

@property
def session(self) -> "Session":
"""Underlying session to the data server.
.. versionadded:: 0.5.1
"""
return self._session

@property
def device_type(self) -> str:
"""Type of the instrument (e.g. MFLI)."""
Expand Down
4 changes: 4 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def base_instrument(mock_connection, session, nodedoc_dev1234_json):
yield BaseInstrument("DEV1234", "test_type", session)


def test_instrument_session_property(base_instrument, session):
assert base_instrument.session == session


def test_basic_setup(mock_connection, base_instrument):
mock_connection.return_value.listNodesJSON.assert_called_with(
f"/{base_instrument.serial}/*"
Expand Down

0 comments on commit 6267dd6

Please sign in to comment.