I have a pytest function that has markers @pytest.mark.win_11 and @pytest.mark.parametrize('os,result',[('win_11','result1'),('win_8','result2')])
When I run test as 'pytest -m win_11', it is running the tests for both set of parameters. I want to run the test only when the os version is win_11.
So, can we combine both marker and parametrize option for single test? Is there a way to skip test with os = win_8 when test is run as 'pytest -m win_11' ?
The code looks as follows:
import pytest
@pytest.mark.win_11
@pytest.mark.parametrize('os_version,result',[('win_11','result1'),('win_8','result2')])
def test_set1_1(os_version, expected_result):
# some code
One option is to assign the marker dynamically through
@pytest.mark.parametrize
Without marker
pytest
With
pytest -m win_11