I have a fixture that yields my git branch, and I want to skip tests if branch is "master", for example.
I currently do it like this:
import pytest
@pytest.fixture
def branch():
yield _get_branch()
def test_something(branch):
if branch == "master":
pytest.skip("No tests on master")
# test ...
What I want to do is:
import pytest
@pytest.fixture
def branch():
yield _get_branch()
@pytest.mark.skipif(pytest.GET_FIXTURE_VALUE("branch") == "master", reason="No tests on master")
def test_something(branch):
# test ...
but I can't find anyway to pytest.GET_FIXTURE_VALUE
.
I found stuff in documentation that mention pytest.config
but that seems to be deprecated...
Using python3.6, pytest>=6
I eventually used this answer as a workaround, but I don't want to close this question, because I'm still looking for a better match to my situation