Skip to content

Instantly share code, notes, and snippets.

Created Jul 25, 2018
What would you like to do?
Missing marker in fixturenames for sub-fixture
import pytest
def fixture_fish(taste):
def pytest_generate_tests(metafunc):
if "taste" in metafunc.fixturenames:
print("** found taste")
marker = metafunc.definition.get_closest_marker(name="taste")
if marker:
metafunc.parametrize("taste", marker.args, ids=None)
print("** didn't find taste")
import pytest
def fixture_fish(fish): # , taste):
yield fish
def test_fish(fish):
Copy link

whimboo commented Jul 25, 2018

Without adding taste as argument to the sub-fixture's list of arguments the marker/fixture taste will not be available for the global fish fixture. Means it is not part of metafunc.fixturenames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment