Skip to content

Adding of parameters by default #9955

@mihalt

Description

@mihalt

Hi! Nice lib. But I found little boring to set the same parameters in tests to use fixture. I would like to see something like that:

pytest.fixture(autouse=True, autoparam=True)
    def myfixture():
        return 1
​
class TestCase:
​
    def test_foo(self):
       assert myfixture + 1
​
 
    def test_bar(self):
       assert myfixture - 1
​
​
def module_func():
       assert myfixture + 2

Is it possible?

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