Commit c1310575 authored by Yong Cong Sin's avatar Yong Cong Sin Committed by Anas Nashif
Browse files

samples: sensor: sensor_shell: update pytest to validate fix



Update the pytest script to exercise the entire
`sensor_channel_name` table with `parse_named_int()`.

The `gauge_desired_charging_current` is selected because
it is the last one in the table before `all`, `all` is not
used because `sensor get sensor@0 all` doesn't return anything.

Signed-off-by: default avatarYong Cong Sin <ycsin@meta.com>
parent eb37b862
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,11 @@ def test_sensor_shell_get(shell: Shell):
    lines = shell.exec_command('sensor get sensor@1 53')
    assert any(['channel type=53(gauge_time_to_empty)' in line for line in lines]), 'expected response not found'

    # Channel should be the last one before 'all' (because 'all' doesn't print anything) so that the
    # for-loop in `parse_named_int()` will go through everything
    lines = shell.exec_command('sensor get sensor@0 gauge_desired_charging_current')
    assert any(['channel type=58(gauge_desired_charging_current)' in line for line in lines]), 'expected response not found'

    logger.info('response is valid')