Skip to content

Undocumented method of fixture parametrization #5712

Closed
@tekhnus

Description

@tekhnus

This test passes:

import pytest


@pytest.fixture
def fixture(argument):
    return argument


@pytest.mark.parametrize("argument", ["foo", "bar"])
def test_with_argument(argument, fixture):
    assert argument == fixture


@pytest.mark.parametrize("argument", ["baz"])
def test_without_argument(fixture):
    assert "baz" == fixture

I failed to find any documentation on this argument passing technique.
Is it a supported and known feature or just a by-product of pytest.mark.parametrize implementation details?

My setup:

$ pip list | grep pytest
pytest                             3.8.0                                           
pytest-socket                      0.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wanteddevelopers would like help from experts on this topictopic: parametrizerelated to @pytest.mark.parametrize

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions