Coverage for tests/unit_tests/commands/test_apio_devices.py: 100%
17 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-06 10:20 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-06 10:20 +0000
1"""Test for the "apio devices" command."""
3from tests.conftest import ApioRunner
4from apio.common.apio_console import cunstyle
5from apio.commands.apio import apio_top_cli as apio
8def test_devices(apio_runner: ApioRunner):
9 """Test "apio devices" """
11 with apio_runner.in_sandbox() as sb:
13 # -- Execute "apio devices"
14 result = sb.invoke_apio_cmd(apio, ["devices"])
15 sb.assert_result_ok(result)
16 assert "apio devices usb" in cunstyle(result.output)
17 assert "apio devices serial" in cunstyle(result.output)
20def test_apio_devices(apio_runner: ApioRunner):
21 """Test "apio devices usb|serial" """
23 with apio_runner.in_sandbox() as sb:
25 # -- Execute "apio devices usb". We run it in a
26 # -- subprocess such that it releases the libusb1 file it uses.
27 # -- This also means that it's not included in the pytest test
28 # -- coverage report.
29 result = sb.invoke_apio_cmd(
30 apio, ["devices", "usb"], in_subprocess=True
31 )
32 sb.assert_result_ok(result)
33 print(result.output)
35 # -- Execute "apio devices serial". We run it in a
36 # -- subprocess such that it releases the libusb1 file it uses.
37 # -- This also means that it's not included in the pytest test
38 # -- coverage report.
39 result = sb.invoke_apio_cmd(
40 apio, ["devices", "serial"], in_subprocess=True
41 )
42 sb.assert_result_ok(result)
43 print(result.output)