diff --git a/AUTHORS b/AUTHORS index 0672d4abf..610d04c4b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -135,6 +135,7 @@ Kale Kundert Katarzyna Jachim Katerina Koukiou Kevin Cox +Kevin J. Foley Kodi B. Arfer Kostis Anagnostopoulos Kristoffer Nordström diff --git a/changelog/5482.bugfix.rst b/changelog/5482.bugfix.rst new file mode 100644 index 000000000..c345458d1 --- /dev/null +++ b/changelog/5482.bugfix.rst @@ -0,0 +1,2 @@ +Fix bug introduced in 4.6.0 causing collection errors when passing +more than 2 positional arguments to ``pytest.mark.parametrize``. diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 9602e8acf..bfbe71c26 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -104,10 +104,7 @@ class ParameterSet(namedtuple("ParameterSet", "values, marks, id")): return cls(parameterset, marks=[], id=None) @staticmethod - def _parse_parametrize_args(argnames, argvalues, **_): - """It receives an ignored _ (kwargs) argument so this function can - take also calls from parametrize ignoring scope, indirect, and other - arguments...""" + def _parse_parametrize_args(argnames, argvalues, *args, **kwargs): if not isinstance(argnames, (tuple, list)): argnames = [x.strip() for x in argnames.split(",") if x.strip()] force_tuple = len(argnames) == 1 diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index 945ab8627..d90787894 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -1765,3 +1765,16 @@ class TestMarkersWithParametrization(object): result.stdout.fnmatch_lines( ["*test_func_a*0*PASS*", "*test_func_a*2*PASS*", "*test_func_b*10*PASS*"] ) + + def test_parametrize_positional_args(self, testdir): + testdir.makepyfile( + """ + import pytest + + @pytest.mark.parametrize("a", [1], False) + def test_foo(a): + pass + """ + ) + result = testdir.runpytest() + result.assert_outcomes(passed=1)