Skip to content

Add possibility to pass parameter to the fixture from another fixture #1694

Closed
@OlegKuzovkov

Description

@OlegKuzovkov

Could you please implement possibility to pass parameter from one fixture to the parent one?
I have a complex fixture hierarchy in my test framework. I have some cases when i really need to have this feature.

Example:

@pytest.fixture(scope='session')
def fixture_1(request):
    return request.param

@pytest.fixture
def fixture_2(fixture_1): # Need to pass parameter here to fixture_1
    print (fixture_1)

So far I can pass parameter to the fixture from test using:

@pytest.mark.parametrize('fixture_1', ['parameter'], indirect=True)
def test_1(fixture_1):
     print (fixture_1)

Need to have exactly the same thing from fixture.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questiongeneral question, might be closed after 2 weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions