Skip to content

pytest 3.3.0 immutable fixture params #2959

@popravich

Description

@popravich

Before v3.3.0 it was possible to mutate fixture parameters, since v3.3.0 params gets "frozen"
(I guess its introduced with this commit 07b2b18)

I was using this feature to setup fixture parameters based on command-line options:

BINS = []

@pytest.fixture(scope='session', params=BINS, ids=...)
def server_bin(request):
    return request.param

@pytest.fixture(scope='session')
def run_server(server_bin):
    pass # start application

def pytest_configure(config):
    BINS[:] = config.getoption('--server')[:]

So my questions:

  • Is this new behavior intended or its a bug?
  • And if its intended what is new way to make dynamic parameters?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions