Skip to content

Parametrize error when passing positional args #5482

@kevinjfoley

Description

@kevinjfoley

Starting with 4.6.0, when passing anything but argnames and argvalues to pytest.mark.parametrize as position arguments, pytest fails during collection with

_pytest/fixtures.py:1145: in _get_direct_parametrize_args
    *marker.args, **marker.kwargs
E TypeError: _parse_parametrize_args() takes exactly 2 arguments (4 given)

a minimal example:

import pytest
@pytest.mark.parametrize(["a", "b"], [(1, 2), (3, 4)], False, ["1", "2"])
def test_t_pos(a, b):
    assert a + 1 == b

I believe the issue stems from this PR - #5254. The new _parse_parametrize_args method only takes argnames and argvalues as positional arguments and expects all additional arguments to be keywords.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions