Skip to content

Consider using dictionaries for pytest fixtures instead of lists #179

@tennlee

Description

@tennlee

see e.g. https://stackoverflow.com/questions/59544165/how-to-pass-dictionary-to-test

Many tests have a core test function, and then many use cases supplied using a pytest fixture, defined as a long list.
Reading and interpreting the components of the list can be difficult, particularly when not readably close to the test function arguments. The semantic connection between the list elements and the test arguments can be lost.

Using a dictionary, although potentially repetitive, could provide a more expressive way to define the test cases. I would like to see this explored on some examples to see if it is a more readable pattern.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions