2023-05-26 17:33:25 +08:00
|
|
|
==============
|
|
|
|
Pytest Twister harness
|
|
|
|
==============
|
|
|
|
|
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
|
|
|
If you plan to use this plugin with Twister, then you don't need to install it
|
|
|
|
separately by pip. When Twister uses this plugin for pytest tests, it updates
|
|
|
|
`PYTHONPATH` variable, and then extends pytest command by
|
|
|
|
`-p twister_harness.plugin` argument.
|
|
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
|
|
|
Run exemplary test shell application by Twister:
|
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
cd ${ZEPHYR_BASE}
|
|
|
|
|
2023-11-16 16:50:30 +08:00
|
|
|
# native_sim & QEMU
|
|
|
|
./scripts/twister -p native_sim -p qemu_x86 -T samples/subsys/testsuite/pytest/shell
|
2023-05-26 17:33:25 +08:00
|
|
|
|
|
|
|
# hardware
|
|
|
|
./scripts/twister -p nrf52840dk_nrf52840 --device-testing --device-serial /dev/ttyACM0 -T samples/subsys/testsuite/pytest/shell
|
|
|
|
|
|
|
|
or build shell application by west and call pytest directly:
|
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
export PYTHONPATH=${ZEPHYR_BASE}/scripts/pylib/pytest-twister-harness/src:${PYTHONPATH}
|
|
|
|
|
|
|
|
cd ${ZEPHYR_BASE}/samples/subsys/testsuite/pytest/shell
|
|
|
|
|
2023-11-16 16:50:30 +08:00
|
|
|
# native_sim
|
|
|
|
west build -p -b native_sim -- -DCONFIG_NATIVE_UART_0_ON_STDINOUT=y
|
2023-05-26 17:33:25 +08:00
|
|
|
pytest --twister-harness --device-type=native --build-dir=build -p twister_harness.plugin
|
|
|
|
|
|
|
|
# QEMU
|
|
|
|
west build -p -b qemu_x86 -- -DQEMU_PIPE=qemu-fifo
|
|
|
|
pytest --twister-harness --device-type=qemu --build-dir=build -p twister_harness.plugin
|
|
|
|
|
|
|
|
# hardware
|
|
|
|
west build -p -b nrf52840dk_nrf52840
|
|
|
|
pytest --twister-harness --device-type=hardware --device-serial=/dev/ttyACM0 --build-dir=build -p twister_harness.plugin
|