Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
zhindes committed Feb 7, 2024
1 parent 2fecaba commit 16085a8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 38 deletions.
8 changes: 6 additions & 2 deletions tests/component/_task_modules/channels/test_ai_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,9 @@ def test___task___add_teds_ai_pos_lvdt_chan___sets_channel_attributes(
sim_position_device: Device,
lvdt_teds_file_path,
):
# Our LVDT/RVDT TEDS files are invalid, but we can validate we got deep into the driver.
# A bug in the driver prevents us from testing the full functionality of this method.
# AB#2647979: Devices that don't support Voltage, Custom Voltage with Excitation, Resistance, or
# RTD inadvertently don't support TEDS (e.g. PXIe-4340)
with pytest.raises(DaqError) as exc_info:
task.ai_channels.add_teds_ai_pos_lvdt_chan(
sim_position_device.ai_physical_chans[0].name,
Expand All @@ -646,7 +648,9 @@ def test___task___add_teds_ai_pos_rvdt_chan___sets_channel_attributes(
sim_position_device: Device,
rvdt_teds_file_path,
):
# Our LVDT/RVDT TEDS files are invalid, but we can validate we got deep into the driver.
# A bug in the driver prevents us from testing the full functionality of this method.
# AB#2647979: Devices that don't support Voltage, Custom Voltage with Excitation, Resistance, or
# RTD inadvertently don't support TEDS (e.g. PXIe-4340)
with pytest.raises(DaqError) as exc_info:
task.ai_channels.add_teds_ai_pos_rvdt_chan(
sim_position_device.ai_physical_chans[0].name,
Expand Down
72 changes: 36 additions & 36 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,110 +513,110 @@ def interpreter(system: nidaqmx.system.System) -> BaseInterpreter:


@pytest.fixture
def teds_assets_directory(test_assets_directory) -> pathlib.Path:
def teds_assets_directory(test_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns the path to TEDS assets."""
return pathlib.Path(test_assets_directory) / "teds"
return test_assets_directory / "teds"


@pytest.fixture
def voltage_teds_file_path(teds_assets_directory) -> pathlib.Path:
def voltage_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "Voltage.ted"
return teds_assets_directory / "Voltage.ted"


@pytest.fixture
def accelerometer_teds_file_path(teds_assets_directory) -> pathlib.Path:
def accelerometer_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "Accelerometer.ted"
return teds_assets_directory / "Accelerometer.ted"


@pytest.fixture
def bridge_teds_file_path(teds_assets_directory) -> pathlib.Path:
def bridge_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
# Our normal bridge sensor TEDS file is incompatible with most devices. It
# has a 1ohm bridge resistance.
return pathlib.Path(teds_assets_directory) / "forcebridge.ted"
return teds_assets_directory / "forcebridge.ted"


@pytest.fixture
def force_bridge_teds_file_path(teds_assets_directory) -> pathlib.Path:
def force_bridge_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "forcebridge.ted"
return teds_assets_directory / "forcebridge.ted"


@pytest.fixture
def current_teds_file_path(teds_assets_directory) -> pathlib.Path:
def current_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "Current.ted"
return teds_assets_directory / "Current.ted"


@pytest.fixture
def force_iepe_teds_file_path(teds_assets_directory) -> pathlib.Path:
def force_iepe_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "ForceSensor.ted"
return teds_assets_directory / "ForceSensor.ted"


@pytest.fixture
def microphone_teds_file_path(teds_assets_directory) -> pathlib.Path:
def microphone_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "Microphone.ted"
return teds_assets_directory / "Microphone.ted"


@pytest.fixture
def lvdt_teds_file_path(teds_assets_directory) -> pathlib.Path:
def lvdt_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "LVDT.ted"
return teds_assets_directory / "LVDT.ted"


@pytest.fixture
def rvdt_teds_file_path(teds_assets_directory) -> pathlib.Path:
def rvdt_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "RVDT.ted"
return teds_assets_directory / "RVDT.ted"


@pytest.fixture
def pressure_bridge_teds_file_path(teds_assets_directory) -> pathlib.Path:
def pressure_bridge_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "pressurebridge.ted"
return teds_assets_directory / "pressurebridge.ted"


@pytest.fixture
def torque_bridge_teds_file_path(teds_assets_directory) -> pathlib.Path:
def torque_bridge_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "torquebridge.ted"
return teds_assets_directory / "torquebridge.ted"


@pytest.fixture
def resistance_teds_file_path(teds_assets_directory) -> pathlib.Path:
def resistance_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "Resistance.ted"
return teds_assets_directory / "Resistance.ted"


@pytest.fixture
def rtd_teds_file_path(teds_assets_directory) -> pathlib.Path:
def rtd_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "TempRTD.ted"
return teds_assets_directory / "TempRTD.ted"


@pytest.fixture
def strain_gage_teds_file_path(teds_assets_directory) -> pathlib.Path:
def strain_gage_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "StrainGage.ted"
return teds_assets_directory / "StrainGage.ted"


@pytest.fixture
def thermocouple_teds_file_path(teds_assets_directory) -> pathlib.Path:
def thermocouple_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "TempTC.ted"
return teds_assets_directory / "TempTC.ted"


@pytest.fixture
def thermistor_iex_teds_file_path(teds_assets_directory) -> pathlib.Path:
def thermistor_iex_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "ThermistorIex.ted"
return teds_assets_directory / "ThermistorIex.ted"


@pytest.fixture
def thermistor_vex_teds_file_path(teds_assets_directory) -> pathlib.Path:
def thermistor_vex_teds_file_path(teds_assets_directory: pathlib.Path) -> pathlib.Path:
"""Returns a TEDS file path."""
return pathlib.Path(teds_assets_directory) / "ThermistorVex.ted"
return teds_assets_directory / "ThermistorVex.ted"
Binary file added tests/test_assets/teds/LVDT.ted
Binary file not shown.
Binary file added tests/test_assets/teds/RVDT.ted
Binary file not shown.

0 comments on commit 16085a8

Please sign in to comment.