diff options
| author | Tom Rini <[email protected]> | 2026-03-25 14:38:28 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-03-25 14:38:28 -0600 |
| commit | 8813d74163e4d84dbd4fb30d9639f01c0acb6d39 (patch) | |
| tree | 8b8d8b148c288178e19045280852097046725ec5 /test | |
| parent | 6701997e9ca2cab0c0e1cde96437ac1dabefdaa1 (diff) | |
| parent | 0f101dac8fb6792f981c78ccd7a284e553ce5764 (diff) | |
Merge patch series "test/py: gpio: cleanups and improvement"
David Lechner <[email protected]> says:
I wanted to do some quick tests to make sure gpios were working without
having to dig out a schematic. Which means I didn't want to set any GPIO
as an output first without checking. So the main point here is the last
patch which allows gpio_op_pin to be optional and skip the test instead
of failing with exception. This works similar to several other config
options that are already optional in this module.
I also noticed a few easy things to clean up while I was looking at the
file, so there are a couple of extra patches for that.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'test')
| -rw-r--r-- | test/py/tests/test_gpio.py | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py index 46b674b7653..eba7bab7589 100644 --- a/test/py/tests/test_gpio.py +++ b/test/py/tests/test_gpio.py @@ -4,8 +4,6 @@ # Copyright (c) 2020 Alex Kiernan <[email protected]> import pytest -import time -import utils """ test_gpio_input is intended to test the fix 4dbc107f4683. @@ -136,8 +134,12 @@ def test_gpio_set_generic(ubman): if not f: pytest.skip("gpio not configured") - gpio_pin_adr = f['gpio_op_pin']; - gpio_set_value = f['gpio_set_value']; + gpio_pin_adr = f.get('gpio_op_pin') + + if gpio_pin_adr is None: + pytest.skip("gpio_op_pin is not configured") + + gpio_set_value = f['gpio_set_value'] cmd = 'gpio set ' + gpio_pin_adr @@ -160,8 +162,12 @@ def test_gpio_clear_generic(ubman): if not f: pytest.skip("gpio not configured") - gpio_pin_adr = f['gpio_op_pin']; - gpio_clear_value = f['gpio_clear_value']; + gpio_pin_adr = f.get('gpio_op_pin') + + if gpio_pin_adr is None: + pytest.skip("gpio_op_pin is not configured") + + gpio_clear_value = f['gpio_clear_value'] cmd = 'gpio clear ' + gpio_pin_adr @@ -184,9 +190,13 @@ def test_gpio_toggle_generic(ubman): if not f: pytest.skip("gpio not configured") - gpio_pin_adr = f['gpio_op_pin']; - gpio_set_value = f['gpio_set_value']; - gpio_clear_value = f['gpio_clear_value']; + gpio_pin_adr = f.get('gpio_op_pin') + + if gpio_pin_adr is None: + pytest.skip("gpio_op_pin is not configured") + + gpio_set_value = f['gpio_set_value'] + gpio_clear_value = f['gpio_clear_value'] cmd = 'gpio set ' + gpio_pin_adr response = ubman.run_command(cmd) @@ -212,8 +222,8 @@ def test_gpio_input_generic(ubman): if not f: pytest.skip("gpio not configured") - gpio_pin_adr = f['gpio_ip_pin_clear']; - gpio_clear_value = f['gpio_clear_value']; + gpio_pin_adr = f['gpio_ip_pin_clear'] + gpio_clear_value = f['gpio_clear_value'] cmd = 'gpio input ' + gpio_pin_adr @@ -222,8 +232,8 @@ def test_gpio_input_generic(ubman): assert good_response in response - gpio_pin_adr = f['gpio_ip_pin_set']; - gpio_set_value = f['gpio_set_value']; + gpio_pin_adr = f['gpio_ip_pin_set'] + gpio_set_value = f['gpio_set_value'] cmd = 'gpio input ' + gpio_pin_adr |
