Skip to content

fixture does not work with lambdas #278

@vyasr

Description

@vyasr

First of all I want to say thanks for a great plugin! I've been making extensive use of it recently. I've found a few minor issues that I wanted to raise, so I wanted to say thank you first!

The problem that I'm running into is that pytest_cases.fixture does not support lambdas, but pytest.fixture does.

import pytest
import pytest_cases

globals()['fix'] = pytest.fixture(lambda: 42)  # Works
globals()['fix2'] = pytest_cases.fixture(lambda: 42)  # Doesn't work

For context, I am basically doing what is described in this comment to dynamically generate fixtures, which is why using a lambda would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions