-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Component tests for Global Chans, Task Done, and Watchdog (#548)
* Add fixtures for added simulated devices * Add configuration for new simulated devices * Additional component tests * Change to 9189 for more slots * Fix linting errors * Update tests/max_config/nidaqmxMaxConfig.ini Co-authored-by: Zach Hindes <[email protected]> * Review comments * More linting fixes * Review comments * Fix lint issues * Missing change * Missing pytest.fixtures statement * Update tests/component/system/storage/test_persisted_channel.py Co-authored-by: Brad Keryan <[email protected]> * Update tests/component/test_watchdog.py Co-authored-by: Brad Keryan <[email protected]> * Update tests/component/test_watchdog.py Co-authored-by: Brad Keryan <[email protected]> * Update tests/component/test_watchdog.py Co-authored-by: Brad Keryan <[email protected]> * Update tests/component/test_watchdog.py Co-authored-by: Brad Keryan <[email protected]> * Fix lint issues --------- Co-authored-by: Zach Hindes <[email protected]> Co-authored-by: Brad Keryan <[email protected]>
- Loading branch information
1 parent
44f2486
commit a60f369
Showing
7 changed files
with
196 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
from nidaqmx import Task | ||
from nidaqmx.constants import WatchdogAOExpirState, WatchdogCOExpirState | ||
from nidaqmx.system import Device | ||
from nidaqmx.system.watchdog import AOExpirationState, COExpirationState | ||
|
||
|
||
def test___watchdog_task___cfg_watchdog_ao_expir_states___no_error( | ||
generate_watchdog_task: Task, sim_9189_device: Device, sim_9263_device: Device | ||
): | ||
watchdog_task = generate_watchdog_task(f"{sim_9189_device.name}", timeout=0.8) | ||
expir_states = [ | ||
AOExpirationState( | ||
physical_channel=sim_9263_device.ao_physical_chans[0].name, | ||
expiration_state=0.0, | ||
output_type=WatchdogAOExpirState.VOLTAGE, | ||
), | ||
AOExpirationState( | ||
physical_channel=sim_9263_device.ao_physical_chans[1].name, | ||
expiration_state=0.0, | ||
output_type=WatchdogAOExpirState.VOLTAGE, | ||
), | ||
] | ||
|
||
watchdog_task.cfg_watchdog_ao_expir_states(expir_states) | ||
watchdog_task.start() | ||
|
||
assert not watchdog_task.expired | ||
assert watchdog_task.timeout == 0.8 | ||
assert ( | ||
watchdog_task.expiration_states[sim_9263_device.ao_physical_chans[1].name].ao_state == 0.0 | ||
) | ||
assert ( | ||
watchdog_task.expiration_states[sim_9263_device.ao_physical_chans[1].name].ao_output_type | ||
== WatchdogAOExpirState.VOLTAGE | ||
) | ||
|
||
|
||
def test___watchdog_task___cfg_watchdog_co_expir_states___no_error( | ||
generate_watchdog_task: Task, sim_9189_device: Device, sim_9401_device: Device | ||
): | ||
watchdog_task = generate_watchdog_task(f"{sim_9189_device.name}", timeout=0.8) | ||
expir_states = [ | ||
COExpirationState( | ||
physical_channel=sim_9401_device.co_physical_chans[0].name, | ||
expiration_state=WatchdogCOExpirState.LOW, | ||
), | ||
COExpirationState( | ||
physical_channel=sim_9401_device.co_physical_chans[1].name, | ||
expiration_state=WatchdogCOExpirState.LOW, | ||
), | ||
] | ||
|
||
watchdog_task.cfg_watchdog_co_expir_states(expir_states) | ||
watchdog_task.start() | ||
|
||
assert not watchdog_task.expired | ||
assert watchdog_task.timeout == 0.8 | ||
assert ( | ||
watchdog_task.expiration_states[sim_9401_device.co_physical_chans[1].name].co_state | ||
== WatchdogCOExpirState.LOW | ||
) | ||
|
||
|
||
def test___watchdog_task___clear_expiration___no_error( | ||
generate_watchdog_task: Task, sim_9189_device: Device, sim_9263_device: Device | ||
): | ||
watchdog_task = generate_watchdog_task(f"{sim_9189_device.name}", timeout=0.8) | ||
expir_states = [ | ||
AOExpirationState( | ||
physical_channel=sim_9263_device.ao_physical_chans[0].name, | ||
expiration_state=0.0, | ||
output_type=WatchdogAOExpirState.VOLTAGE, | ||
), | ||
AOExpirationState( | ||
physical_channel=sim_9263_device.ao_physical_chans[1].name, | ||
expiration_state=0.0, | ||
output_type=WatchdogAOExpirState.VOLTAGE, | ||
), | ||
] | ||
watchdog_task.cfg_watchdog_ao_expir_states(expir_states) | ||
watchdog_task.start() | ||
|
||
watchdog_task.clear_expiration() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters