1==============
2Pytest Twister harness
3==============
4
5Installation
6------------
7
8If you plan to use this plugin with Twister, then you don't need to install it
9separately by pip. When Twister uses this plugin for pytest tests, it updates
10`PYTHONPATH` variable, and then extends pytest command by
11`-p twister_harness.plugin` argument.
12
13
14Usage
15-----
16
17Run exemplary test shell application by Twister:
18
19.. code-block:: sh
20
21  cd ${ZEPHYR_BASE}
22
23  # native_sim & QEMU
24  ./scripts/twister -p native_sim -p qemu_x86 -T samples/subsys/testsuite/pytest/shell
25
26  # hardware
27  ./scripts/twister -p nrf52840dk_nrf52840 --device-testing --device-serial /dev/ttyACM0 -T samples/subsys/testsuite/pytest/shell
28
29or build shell application by west and call pytest directly:
30
31.. code-block:: sh
32
33  export PYTHONPATH=${ZEPHYR_BASE}/scripts/pylib/pytest-twister-harness/src:${PYTHONPATH}
34
35  cd ${ZEPHYR_BASE}/samples/subsys/testsuite/pytest/shell
36
37  # native_sim
38  west build -p -b native_sim -- -DCONFIG_NATIVE_UART_0_ON_STDINOUT=y
39  pytest --twister-harness --device-type=native --build-dir=build -p twister_harness.plugin
40
41  # QEMU
42  west build -p -b qemu_x86 -- -DQEMU_PIPE=qemu-fifo
43  pytest --twister-harness --device-type=qemu --build-dir=build -p twister_harness.plugin
44
45  # hardware
46  west build -p -b nrf52840dk_nrf52840
47  pytest --twister-harness --device-type=hardware --device-serial=/dev/ttyACM0 --build-dir=build -p twister_harness.plugin
48