summaryrefslogtreecommitdiff
path: root/test/py/tests/test_i2c.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-02-09 09:07:14 -0700
committerSimon Glass <sjg@chromium.org>2025-03-15 10:38:38 +0000
commit752c3769874596d012cd8325099d2ae20123f989 (patch)
treeb50b3025ff2d124a96793b64d83b8a7d1cb2326c /test/py/tests/test_i2c.py
parent00dfb7038ea4dfe9d9667143bfecd11c05cab6fa (diff)
test/py: Shorten u_boot_console
This fixture name is quite long and results in lots of verbose code. We know this is U-Boot so the 'u_boot_' part is not necessary. But it is also a bit of a misnomer, since it provides access to all the information available to tests. It is not just the console. It would be too confusing to use con as it would be confused with config and it is probably too short. So shorten it to 'ubman'. Signed-off-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/u-boot/CAFLszTgPa4aT_J9h9pqeTtLCVn4x2JvLWRcWRD8NaN3uoSAtyA@mail.gmail.com/
Diffstat (limited to 'test/py/tests/test_i2c.py')
-rw-r--r--test/py/tests/test_i2c.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/py/tests/test_i2c.py b/test/py/tests/test_i2c.py
index 825d0c2e6eb..69b11930ce7 100644
--- a/test/py/tests/test_i2c.py
+++ b/test/py/tests/test_i2c.py
@@ -31,8 +31,8 @@ env__i2c_eeprom_device_test = {
}
"""
-def get_i2c_test_env(u_boot_console):
- f = u_boot_console.config.env.get("env__i2c_device_test", None)
+def get_i2c_test_env(ubman):
+ f = ubman.config.env.get("env__i2c_device_test", None)
if not f:
pytest.skip("No I2C device to test!")
else:
@@ -43,34 +43,34 @@ def get_i2c_test_env(u_boot_console):
return bus_list, probe_all
@pytest.mark.buildconfigspec("cmd_i2c")
-def test_i2c_bus(u_boot_console):
- bus_list, probe = get_i2c_test_env(u_boot_console)
+def test_i2c_bus(ubman):
+ bus_list, probe = get_i2c_test_env(ubman)
bus = random.choice(bus_list)
expected_response = f"Bus {bus}:"
- response = u_boot_console.run_command("i2c bus")
+ response = ubman.run_command("i2c bus")
assert expected_response in response
@pytest.mark.buildconfigspec("cmd_i2c")
-def test_i2c_dev(u_boot_console):
- bus_list, probe = get_i2c_test_env(u_boot_console)
+def test_i2c_dev(ubman):
+ bus_list, probe = get_i2c_test_env(ubman)
expected_response = "Current bus is"
- response = u_boot_console.run_command("i2c dev")
+ response = ubman.run_command("i2c dev")
assert expected_response in response
@pytest.mark.buildconfigspec("cmd_i2c")
-def test_i2c_probe(u_boot_console):
- bus_list, probe = get_i2c_test_env(u_boot_console)
+def test_i2c_probe(ubman):
+ bus_list, probe = get_i2c_test_env(ubman)
bus = random.choice(bus_list)
expected_response = f"Setting bus to {bus}"
- response = u_boot_console.run_command(f"i2c dev {bus}")
+ response = ubman.run_command(f"i2c dev {bus}")
assert expected_response in response
expected_response = "Valid chip addresses:"
- response = u_boot_console.run_command("i2c probe")
+ response = ubman.run_command("i2c probe")
assert expected_response in response
@pytest.mark.buildconfigspec("cmd_i2c")
-def test_i2c_eeprom(u_boot_console):
- f = u_boot_console.config.env.get("env__i2c_eeprom_device_test", None)
+def test_i2c_eeprom(ubman):
+ f = ubman.config.env.get("env__i2c_eeprom_device_test", None)
if not f:
pytest.skip("No I2C eeprom to test!")
@@ -89,17 +89,17 @@ def test_i2c_eeprom(u_boot_console):
)
# Enable i2c mux bridge
- u_boot_console.run_command("i2c dev %x" % bus)
- u_boot_console.run_command("i2c probe")
- output = u_boot_console.run_command("i2c md %x 0 5" % addr)
+ ubman.run_command("i2c dev %x" % bus)
+ ubman.run_command("i2c probe")
+ output = ubman.run_command("i2c md %x 0 5" % addr)
assert value in output
@pytest.mark.buildconfigspec("cmd_i2c")
-def test_i2c_probe_all_buses(u_boot_console):
- bus_list, probe = get_i2c_test_env(u_boot_console)
+def test_i2c_probe_all_buses(ubman):
+ bus_list, probe = get_i2c_test_env(ubman)
bus = random.choice(bus_list)
expected_response = f"Bus {bus}:"
- response = u_boot_console.run_command("i2c bus")
+ response = ubman.run_command("i2c bus")
assert expected_response in response
# Get all the bus list
@@ -109,8 +109,8 @@ def test_i2c_probe_all_buses(u_boot_console):
for dev in bus_list:
expected_response = f"Setting bus to {dev}"
- response = u_boot_console.run_command(f"i2c dev {dev}")
+ response = ubman.run_command(f"i2c dev {dev}")
assert expected_response in response
expected_response = "Valid chip addresses:"
- response = u_boot_console.run_command("i2c probe")
+ response = ubman.run_command("i2c probe")
assert expected_response in response