From b02b0a0c6cb1b977718d05182ac492f04c996561 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 12 Mar 2026 15:33:39 -0500 Subject: [PATCH 1/3] test/py: gpio: remove unused imports Remove unused imports in test_gpio.py. Signed-off-by: David Lechner --- test/py/tests/test_gpio.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py index 46b674b7653..2d4a708aa84 100644 --- a/test/py/tests/test_gpio.py +++ b/test/py/tests/test_gpio.py @@ -4,8 +4,6 @@ # Copyright (c) 2020 Alex Kiernan import pytest -import time -import utils """ test_gpio_input is intended to test the fix 4dbc107f4683. From 908db6c647ce1cf265f0bafd98578ad903c16a04 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 12 Mar 2026 15:33:40 -0500 Subject: [PATCH 2/3] test/py: gpio: removing trailing semicolons Remove trailing semicolons in test_gpio.py. Python does not require them and they are considered improper style. Signed-off-by: David Lechner --- test/py/tests/test_gpio.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py index 2d4a708aa84..059b5141b0f 100644 --- a/test/py/tests/test_gpio.py +++ b/test/py/tests/test_gpio.py @@ -134,8 +134,8 @@ 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['gpio_op_pin'] + gpio_set_value = f['gpio_set_value'] cmd = 'gpio set ' + gpio_pin_adr @@ -158,8 +158,8 @@ 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['gpio_op_pin'] + gpio_clear_value = f['gpio_clear_value'] cmd = 'gpio clear ' + gpio_pin_adr @@ -182,9 +182,9 @@ 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['gpio_op_pin'] + 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) @@ -210,8 +210,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 @@ -220,8 +220,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 From 0f101dac8fb6792f981c78ccd7a284e553ce5764 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 12 Mar 2026 15:33:41 -0500 Subject: [PATCH 3/3] test/py: gpio: allow omitting gpio_op_pin Modify tests that make use of gpio_op_pin from env__gpio_dev_config to be skipped if gpio_op_pin is not provided. This is useful in cases where one might not be sure which GPIOs are safe to use as outputs that can be toggled without causing problems. Signed-off-by: David Lechner --- test/py/tests/test_gpio.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py index 059b5141b0f..eba7bab7589 100644 --- a/test/py/tests/test_gpio.py +++ b/test/py/tests/test_gpio.py @@ -134,7 +134,11 @@ def test_gpio_set_generic(ubman): if not f: pytest.skip("gpio not configured") - gpio_pin_adr = f['gpio_op_pin'] + 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'] @@ -158,7 +162,11 @@ def test_gpio_clear_generic(ubman): if not f: pytest.skip("gpio not configured") - gpio_pin_adr = f['gpio_op_pin'] + 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'] @@ -182,7 +190,11 @@ def test_gpio_toggle_generic(ubman): if not f: pytest.skip("gpio not configured") - gpio_pin_adr = f['gpio_op_pin'] + 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']