1# Copyright (c) 2020 Intel Corporation. 2# 3# SPDX-License-Identifier: Apache-2.0 4 5import pytest 6 7 8# add option "--cmdopt" to pytest, or it will report "unknown option" 9# this option is passed from twister. 10def pytest_addoption(parser): 11 parser.addoption( 12 '--cmdopt' 13 ) 14 parser.addoption( 15 '--custom-pytest-arg' 16 ) 17 18# define fixture to return value of option "--cmdopt", this fixture 19# will be requested by other fixture of tests. 20@pytest.fixture() 21def cmdopt(request): 22 return request.config.getoption('--cmdopt') 23 24# define fixture to return value of option "--custom-pytest-arg", this fixture 25# will be requested by other fixture of tests. 26@pytest.fixture() 27def custom_pytest_arg(request): 28 return request.config.getoption('--custom-pytest-arg') 29