Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech Debt : Display proper error message when update pin map step is… #719

Merged
11 changes: 8 additions & 3 deletions examples/game_of_life/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidaqmx_analog_input/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidcpower_source_dc_voltage/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidigital_spi/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidmm_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nifgen_standard_function/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/niscope_acquire_waveform/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/niswitch_control_relays/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nivisa_dmm_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/output_voltage_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/sample_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import click
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ class TestStandSupport(object):
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Loading