Skip to content

Using fixture that returns a list of parameters, is it possible? #60

@ghost

Description

Here's my fixture:

@fixture
def devices(scope='module');
    with connect(get_all_devices()) as connected_devices:
        yield connected_devices

Here's how I want to use it:

@parametrize('device', devices)
def test_routine(device):
    device.do_something()
    assert device.is_ok()

What I'm doing instead:

def test_routine(subtests, devices):
    for index, device in enumerate(devices):
        with subtests.test(device, i=index):
            device.do_something()
            assert device.is_ok()

Is this possible with lazy fixture or any other method?

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