From 16085a8f71ed009d27bbaa09e47ca95e3a54c175 Mon Sep 17 00:00:00 2001 From: Zach Hindes Date: Wed, 7 Feb 2024 11:06:21 -0600 Subject: [PATCH] code review --- .../_task_modules/channels/test_ai_channel.py | 8 +- tests/conftest.py | 72 +++++++++--------- tests/test_assets/teds/LVDT.ted | Bin 0 -> 325 bytes tests/test_assets/teds/RVDT.ted | Bin 0 -> 325 bytes 4 files changed, 42 insertions(+), 38 deletions(-) create mode 100644 tests/test_assets/teds/LVDT.ted create mode 100644 tests/test_assets/teds/RVDT.ted diff --git a/tests/component/_task_modules/channels/test_ai_channel.py b/tests/component/_task_modules/channels/test_ai_channel.py index 58791cb5..e51ad553 100644 --- a/tests/component/_task_modules/channels/test_ai_channel.py +++ b/tests/component/_task_modules/channels/test_ai_channel.py @@ -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, @@ -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, diff --git a/tests/conftest.py b/tests/conftest.py index 4c0a052b..a5647e40 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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" diff --git a/tests/test_assets/teds/LVDT.ted b/tests/test_assets/teds/LVDT.ted new file mode 100644 index 0000000000000000000000000000000000000000..ccf4f1a2e272c44059e1292ce772e0f3a56fb592 GIT binary patch literal 325 zcmcJIQ4Rng2twojmkv`mD>88#6^PIA=zaRl&XNMdK$G&lAG3? U3w*@F)Om{)R2m|f^KfRrTY&IS|EzyD<2vJ({Sy5L6X|5|cq-Z*jHv)=U8A$BhjkqC= W+pc6Ud+53G&ma%}Fk27$w;??-@BlXe literal 0 HcmV?d00001