Lines Matching refs:pytest
3 Integration with pytest test framework
6 *Please mind that integration of twister with pytest is still work in progress. Not every platform
7 type is supported in pytest (yet). If you find any issue with the integration or have an idea for
14 support complex functional testing for applications and libraries”* (`<https://docs.pytest.org/en/7…
15 Python is known for its free libraries and ease of using it for scripting. In addition, pytest
17 A pytest plugin ``pytest-twister-harness`` was introduced to provide an integration between pytest
18 and twister, allowing Zephyr’s community to utilize pytest functionality with keeping twister as
24 By default, there is nothing to be done to enable pytest support in twister. The plugin is
26 ``PYTHONPATH`` with path to this plugin, and then during pytest call, it appends the command with
32 In the case of ``harness: pytest``, most of twister workflow (test suites discovery,
41 If ``harness: pytest`` is used, twister delegates the test execution to pytest, by calling it as
43 through a CLI command. When pytest is done, twister looks for a pytest report (results.xml) and
46 How to create a pytest test
49 An example folder containing a pytest test, application source code and Twister configuration .yaml
55 ├─── pytest/
63 An example of a pytest test is given at
64 :zephyr_file:`samples/subsys/testsuite/pytest/shell/pytest/test_shell.py`. Using the configuration
66 .yaml file contains a ``harness: pytest`` entry, it calls pytest in a separate subprocess. A sample
73 harness: pytest
76 By default, pytest tries to look for tests in a ``pytest`` directory located next to a directory
81 `discovery rules <https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#conventions-for-p…
86 There are two ways for passing extra arguments to the called pytest subprocess:
90 #. Through Twister command line interface as ``--pytest-args`` argument. This can be particularly
96 $ ./scripts/twister --platform native_sim -T samples/subsys/testsuite/pytest/shell \
97 -s samples/subsys/testsuite/pytest/shell/sample.pytest.shell \
98 --pytest-args='-k test_shell_print_version'
110 the core of pytest harness plugin. It is required to launch DUT (initialize logging, flash device,
225 Examples of pytest tests in the Zephyr project
237 How to flash/run application only once per pytest session?
246 harness: pytest
260 harness: pytest
263 - "pytest/test_shell.py::test_shell_print_help"
265 Particular tests can be also chosen by pytest ``-k`` option (more info about pytest keyword
267 …`here <https://docs.pytest.org/en/latest/example/markers.html#using-k-expr-to-select-tests-based-o…
272 harness: pytest
281 $ ./scripts/twister ... --pytest-args='-k test_shell_print_help'
296 How to rerun locally pytest tests without rebuilding application by Twister?
301 copy-pasting from logs command dedicated for spawning pytest (log started by ``Running pytest
304 Is this possible to run pytest tests in parallel?
307 Basically ``pytest-harness-plugin`` wasn't written with intention of running pytest tests in
311 `pytest-xdist plugin <https://pytest-xdist.readthedocs.io/en/stable/>`_) they do so at their own