zephyr/samples/subsys/testsuite/pytest/basic/pytest/conftest.py
Grzegorz Chwierut 23b7f0cdb8 samples: testsuite: exemplary pytest shell test
Adding exemplary pytest shell test to show possibilities of new pytest
plugin. This test uses bidirectional communication between tester and
device under test.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-05-26 13:52:15 -04:00

28 lines
778 B
Python

# Copyright (c) 2020 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
import pytest
# add option "--cmdopt" to pytest, or it will report "unknown option"
# this option is passed from twister.
def pytest_addoption(parser):
parser.addoption(
'--cmdopt'
)
parser.addoption(
'--custom-pytest-arg'
)
# define fixture to return value of option "--cmdopt", this fixture
# will be requested by other fixture of tests.
@pytest.fixture()
def cmdopt(request):
return request.config.getoption('--cmdopt')
# define fixture to return value of option "--custom-pytest-arg", this fixture
# will be requested by other fixture of tests.
@pytest.fixture()
def custom_pytest_arg(request):
return request.config.getoption('--custom-pytest-arg')